query
stringlengths
9
43.3k
document
stringlengths
17
1.17M
metadata
dict
negatives
listlengths
0
30
negative_scores
listlengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
/ search_textbook_range: returns a 2D array of textbooks with each row representing one textbook. Returns a range of results. Example (3040) useful for breaking apart long results. If you want to display results 3040 then youd pass in 30, 10 for $numstart and $numresults
function search_textbook_range($db, $title, $isbn, $author, $numstart, $numresults) { $titlekey = ""; //sql colomn name $isbnkey = ""; //sql column name $authorkey = ""; //sql column name $titlevalue = ""; // sql column value $isbnvalue = ""; // sql column value $authorvalue = ""; // sql column value /* All empty strings returns nothing */ if($title == "" && $isbn == "" && $author == "") { $titlekey = "1"; $isbnkey = "1"; $authorkey = "1"; $titlevalue = "0"; $isbnvalue = "0"; $authorvalue = "0"; } else // If not an empty search { if($title == "") // No search by title { $titlekey = '1'; $titlevalue = '1'; } else // Include search by title { $titlekey = 'title'; $titlevalue = "%".$title."%"; } if($isbn == "") // No search by isbn { $isbnkey = '1'; $isbnvalue = '1'; } else // include search by isbn { $isbnkey = 'isbn'; $isbnvalue = "%".$isbn."%"; } if($author == "") // no search by author { $authorkey = '1'; $authorvalue = '1'; } else // include search by author { $authorkey = 'author'; $authorvalue = "%".$author."%"; } } /* Run the query */ $sql = "SELECT * FROM textbooks where ".$titlekey." LIKE :title and ".$isbnkey." LIKE :isbn and ".$authorkey." LIKE :author and removed=0 ORDER BY date_time DESC LIMIT $numstart, $numresults"; $st = $db->prepare($sql); $st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue)); $us = $st->fetchAll(); return $us; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSearchRange() {}", "public function getSearchRange() {}", "public function getGlossaryByRange($book, $chapter, $start_verse, $end_verse)\n\t{\n\t\t$sql = sprintf(\"\n\t\t\tSELECT g.chinese AS chinese, g.english AS english, g.kind AS kind, v.book, v.chapter, v.start_verse, v.end_verse, p.name AS openbible_place_name\n\t\t\tFROM glossary g\n\t\t\t\tINNER JOIN glossary_verses v ON (g.id=v.glossary_id)\n\t\t\t\tLEFT JOIN openbible_places p ON (g.openbible_places_id=p.id)\n\t\t\tWHERE v.book='%s' AND v.chapter='%s' AND v.start_verse >= '%s' AND v.end_verse <= '%s'\",\n\t\t\tmysqli_real_escape_string($this->db, $book),\n\t\t\tmysqli_real_escape_string($this->db, $chapter),\n\t\t\tmysqli_real_escape_string($this->db, $start_verse),\n\t\t\tmysqli_real_escape_string($this->db, $end_verse)\n\t\t);\n\n\t\t$result = mysqli_query($this->db, $sql);\n\t\tif (!$result)\n\t\t{\n\t\t\techo \"ERROR: Bad query: \" . mysqli_error($this->db);\n\t\t\treturn array();\n\t\t}\n\n\t\t$glossary = array();\n\t\twhile ($row = mysqli_fetch_assoc($result))\n\t\t{\n\t\t\t$glossary[] = $row;\n\t\t}\n\t\tmysqli_free_result($result);\n\n\t\treturn $glossary;\n\t}", "public function getRange($startPage, $encoding = 'UTF-8') {}", "private static function _getSearchResultsPage($searchString, array $words, array $results=array(), $startOffset=0)\n {\n $startOffset = (int) $startOffset;\n $maxResults = 10;\n $totalResults = count($results);\n $results = array_slice($results, $startOffset, $maxResults, TRUE);\n $hasMoreResults = FALSE;\n\n if (($totalResults - ($startOffset + $maxResults)) > 0) {\n $hasMoreResults = TRUE;\n }\n\n // For each result file open it and retrieve the article details.\n $dom = new DomDocument();\n $docsDir = Help::getDocsDirectory();\n\n Channels::includeSystem('GUI');\n $cssHref = self::_getPageCSSPath();\n\n if ($startOffset === 0) {\n $contents = GUI::getDocType();\n $contents .= '<html><head><link href=\"'.$cssHref.'\" type=\"text/css\" rel=\"stylesheet\" />';\n $contents .= '</head><body class=\"Help-iframe searchResultsPage\">';\n }\n\n if (empty($results) === TRUE) {\n if ($startOffset === 0) {\n $contents .= '<h3 class=\"Help-noSearchResults\">'._('No search results').'</h3>';\n }\n } else {\n // Options for the 2nd argument of Help.loadPage function.\n $opts = urlencode(json_encode(array('searchedWords' => $words)));\n\n if ($startOffset === 0) {\n // Show number of results.\n $contents .= sprintf(\n _('<h3>%s results found for <strong>%s</strong></h3>'),\n $totalResults,\n $searchString\n );\n }\n\n $contents .= '<ol id=\"Help-searchResults-list\" class=\"Help-searchResults-list\">';\n\n foreach ($results as $fileName => $score) {\n $dom->loadHTMLFile($docsDir.$fileName);\n\n $id = str_replace('.html', '', basename($fileName));\n $title = $dom->getElementsByTagName('h1')->item(0)->nodeValue;\n $summary = '';\n\n $articleType = 'article';\n if (strpos($id, 'glossary-') === 0) {\n $articleType = 'glossary';\n $termDesc = $dom->getElementsByTagName('div')->item(0);\n $summary = strip_tags($termDesc->nodeValue);\n } else {\n $metaTags = $dom->getElementsByTagName('meta');\n foreach ($metaTags as $metaTag) {\n if ($metaTag->getAttribute('name') === 'summary') {\n $summary = $metaTag->getAttribute('content');\n }\n }\n }\n\n include_once 'Libs/String/String.inc';\n $summary = String::ellipsisize($summary, 100);\n\n $href = 'javascript:parent.window.Help.loadPage(\\''.$id.'\\', '.$opts.');';\n $contents .= '<li class=\"Help-searchResult '.$articleType.'\">';\n $contents .= '<h4><a href=\"'.$href.'\">'.$title.'</a></h4>';\n $contents .= '<div class=\"Help-searchResult-summary\">'.$summary.'</div>';\n $contents .= '</li>';\n }//end foreach\n }//end if\n\n $contents .= '</ol>';\n\n if ($hasMoreResults === TRUE) {\n $href = 'javascript:parent.window.Help.getSearchResults(\\''.$searchString.'\\', '.($startOffset + $maxResults).');';\n $contents .= '<p class=\"Help-searchResults-moreLink\"><a href=\"'.$href.'\">'._('Show more results').'</a></p>';\n }\n\n if ($startOffset === 0) {\n $contents .= '</body></html>';\n }\n\n return $contents;\n\n }", "public function getresults($searchterm)\n {\n $searchTerm = db::escapechars(trim($searchterm));\n \n // Check if there is a campus lock\n $campus = $this->checkCampus();\n if($campus == 'true')\n {\n // Access to all campuses\n $campuslock = '';\n }\n else{\n if($campus == 'false'){\n // No access to search results - no campus specified\n return;\n }\n else{\n $campuslock = $campus; \n }\n }\n // Get the results from the system and display the output\n if(!is_null($searchTerm)){\n $this->findhelp($searchTerm, $campuslock);\n $this->findmembers($searchTerm, $campuslock);\n $this->findgroup($searchTerm, $campuslock);\n $this->findmessages($searchTerm);\n $this->findreminders($searchTerm);\n }\n else{\n print \"<p>No search term provided</p>\";\n }\n \n return;\n }", "public function search($term, $start = null, $end = null)\n {\n $ci = & get_instance();\n $ci->load->model('talks_model', 'talksModel');\n $ci->load->model('user_attend_model', 'userAttend');\n\n $sql = sprintf(\n \"\n select\n u.username,\n u.full_name,\n u.ID,\n u.admin,\n u.active,\n u.last_login,\n u.email\n from\n user u\n where\n lower(username) like %s or\n lower(full_name) like %s\n \", $this->db->escape('%' . $term . '%'), $this->db->escape('%' . $term . '%')\n );\n $query = $this->db->query($sql);\n $results = $query->result();\n foreach ($results as $key => $user) {\n $results[$key]->talk_count = count(\n $ci->talksModel->getSpeakerTalks($user->ID)\n );\n $results[$key]->event_count = count(\n $ci->userAttend->getUserAttending($user->ID)\n );\n }\n\n return $results;\n }", "public static function searchResults($limit, $offset = 0)\n\t{\n\t\treturn self::all()->start($offset)->limit($limit)->rows();\n\t}", "public static function searchDocs($searchString, $startOffset=0)\n {\n $docsDir = Help::getDocsDirectory();\n\n $wordList = array_unique(explode(' ', $searchString));\n $originalWordsList = array();\n foreach ($wordList as $index => $word) {\n $word = preg_replace('/[^a-z0-9_-]/i', '', $word);\n $len = strlen($word);\n if ($len > 3) {\n // Only keep words that has more than 3 characters and remove the\n // last character from the word. This is a simple way to match plurals\n // (e.g. \"goals\" will match \"goal\" and \"test\" will match \"tes\").\n $originalWordsList[] = $word;\n $wordList[$index] = substr($word, 0, -1);\n } else if ($len < 3) {\n unset($wordList[$index]);\n } else {\n $originalWordsList[] = $word;\n }\n }\n\n if (empty($wordList) === TRUE) {\n return self::_getSearchResultsPage($wordList, $originalWordsList);\n }\n\n $words = implode('|', $wordList);\n $sedWords = implode('\\|', $wordList);\n\n // Search articles and glossary file contents.\n $cmd = 'grep -iE \".*('.$words.').*\" '.$docsDir.'* | sed -n -e \"s/<[^>]*>//g\" -e \"/'.$sedWords.'/p\" | awk -F : \\'{print $1}\\' | uniq | grep -E \".*/(article|glossary)-.*\"';\n\n $contentResults = array();\n exec($cmd, $contentResults);\n\n // Search articles and glossary file names.\n $cmd = 'find '.$docsDir.' -regextype posix-egrep -iregex \".*/(article|glossary)-.*('.$words.').*\" -print';\n\n $fileNames = array();\n exec($cmd, $fileNames);\n\n $rawSearchResults = array();\n foreach ($contentResults as $filePath) {\n $matches = array();\n $contents = file_get_contents($filePath);\n $contents = strip_tags($contents);\n $numMatches = preg_match_all('/.*\\b('.$words.').*/imU', $contents, $matches);\n $numWords = str_word_count($contents);\n $score = ((ceil($numMatches / ($numWords * 100)) * 2) + $numMatches);\n\n $rawSearchResults[basename($filePath)] = $score;\n }\n\n $fileScore = 5;\n foreach ($fileNames as $filePath) {\n $fileName = basename($filePath);\n $matches = array();\n $numMatches = preg_match_all('/.*('.$words.').*/iU', $fileName, $matches);\n\n if (isset($rawSearchResults[$fileName]) === FALSE) {\n $rawSearchResults[$fileName] = ($numMatches * $fileScore);\n } else {\n $rawSearchResults[$fileName] += ($numMatches * $fileScore);\n }\n }\n\n if (empty($rawSearchResults) === TRUE) {\n return self::_getSearchResultsPage($wordList, $originalWordsList);\n }\n\n arsort($rawSearchResults);\n\n $contents = self::_getSearchResultsPage($searchString, $originalWordsList, $rawSearchResults, $startOffset);\n return $contents;\n\n }", "function vcn_findwork_results_get_data_freetext_search($params, $print_jurl=false, $jobpagemax=500) {\r\n\r\n\t$search_term = $params['search_term'];\r\n\t$search_term = str_replace('~', '/', $search_term);\r\n\t$search_term = str_replace('*', '\\\\', $search_term);\r\n\r\n\t$common_keywords = vcn_rest_wrapper('vcnoccupationsvc', 'vcncommonkeywords', 'getcommonkeywords', NULL, 'json', 'post', false);\r\n\r\n\t$find_job_query_string = vcn_prepend_the_word_Title($search_term, $common_keywords);\r\n\tif ($params['zipcode']) {\r\n\t\t$find_job_query_string .= \"&zc1=\".$params['zipcode'].\"&rd1=\".$params['distance'];\r\n\t}\r\n\r\n\treturn vcn_get_data_from_apiusjobs($find_job_query_string, $print_jurl, $jobpagemax);\r\n}", "public function searchBookListBetweenDate($start, $end)\n {\n return $this->bookDao->searchBookListBetweenDate($start, $end);\n }", "public function allmarksheet($class, $term, $year)\n\t{\n\t\ttry {\n\n\t\t\t$stmt = $this->con->prepare(\"select * from sixtoeightmarksheet where class=:class and term=:term and year=:year and status=1 order by gpa desc \");\n\t\t\t$stmt->bindValue(':class', $class, PDO::PARAM_STR);\n\t\t\t$stmt->bindValue(':term', $term, PDO::PARAM_STR);\n\t \t\t$stmt->bindValue(':year', $year, PDO::PARAM_STR);\n\t \t\t$stmt->execute();\n\t \t\treturn $stmt->fetchAll(PDO::FETCH_ASSOC);\n\t\t\t\n\t\t} catch (PDOException $e) {\n\t\t\techo \"Error: \".$e->getMessage().\"<br>\";\n\t\t\tdie();\n\t\t}\n\t}", "public function getSearchResults($data,$limit,$start)\n{\n\t$this->db->select('*');\n\t$this->db->where('sample_field', $data['search_key']);\n\t$this->db->limit($limit, $start);\n\t$query = $this->db->get('sample_table');\n\treturn $query->result();\n}", "public static function get_content_for_index(&$instance) {\n global $DB;\n\n // Get context.\n $coursemodule = $DB->get_field('modules', 'id', array('name' => 'book'));\n $params = array('course' => $instance->course, 'module' => $coursemodule, 'instance' => $instance->id);\n $cm = $DB->get_record('course_modules', $params);\n $context = context_module::instance($cm->id);\n\n $documents = array();\n\n // Index entries.\n $entries = $DB->get_records('book_chapters', array('bookid' => $instance->id));\n if ($entries) {\n foreach ($entries as $entry) {\n if (strlen($entry->content) > 0) {\n $arr = get_object_vars($entry);\n $documents[] = new BookPageSearchDocument($arr, $instance->course, $context->id);\n }\n }\n }\n\n return $documents;\n }", "public function rangeToPaginate()\n {\n $pages = array();\n\n if ( $this->lastPage <= $this->maxPagesToList) {\n for ($i = 1; $i <= $this->lastPage; $i++) {\n $pages[] = $i;\n }\n } else if ($this->currentPage <= floor($this->maxPagesToList/2)+1) {\n for ($i = 1; $i <= $this->maxPagesToList; $i++) {\n $pages[] = $i;\n }\n } else if ($this->lastPage <= floor($this->maxPagesToList/2)+$this->currentPage) {\n $begin = $this->lastPage - $this->maxPagesToList + 1;\n for ($i = $begin; $i <= $this->lastPage; $i++) {\n $pages[] = $i;\n }\n } else {\n $begin = $this->currentPage - floor($this->maxPagesToList/2);\n $end = $this->currentPage + floor($this->maxPagesToList/2);\n for ($i = $begin; $i <= $end; $i++) {\n $pages[] = $i;\n }\n }\n return $pages;\n\n }", "public static function searchLineItems($term,\n $start_element = 0, $num_elements = 100)\n {\n // construct url\n $url = self::getBaseUrl() . '?' . http_build_query(array(\n 'search' => $term,\n 'start_element' => $start_element,\n 'num_elements' => $num_elements\n ));\n\n // query app nexus server\n $response = self::makeRequest($url, Api::GET);\n\n // wrap response with app nexus object\n return new AppNexusArray($response, AppNexusObject::MODE_READ_WRITE);\n }", "public function getRange(): array\n {\n if ($this->getPageCount() < $this->rangeLimit) { // Not enough pages to apply range limit\n $start = 1;\n $stop = $this->getPageCount();\n } else { // Enough page to apply range limit\n if ($this->getPage() <= $this->rangeLimit / 2) { // Cannot center, current page too far on the left\n $start = 1;\n $stop = $start + $this->rangeLimit - 1;\n } elseif ($this->getPage() + ceil($this->rangeLimit / 2) > $this->getPageCount()\n ) { // Cannot center, current page too far on the right\n $stop = $this->getPageCount();\n $start = $stop - $this->rangeLimit + 1;\n } else { // Enough space on both sides, we can center\n $start = $this->getPage() - floor($this->rangeLimit / 2) + 1;\n $stop = $start + $this->rangeLimit - 1;\n }\n }\n\n return range($start, $stop);\n }", "public function findByTerm(string $searchTerm): LengthAwarePaginator;", "public function findByTerm(string $searchTerm): LengthAwarePaginator;", "function ml_wpsearch_search($querytext)\n{\n $querytext = trim($querytext);\n if (!$querytext) {\n return [null, null, null];\n }\n\n $results = ml_wpsearch_search_query($querytext, array(\n 'start' => isset($_REQUEST['start']) ? $_REQUEST['start'] : 1,\n 'pageLength' => isset($_REQUEST['pageLength']) ? $_REQUEST['pageLength'] : 10,\n ));\n if (null === $results)\n {\n return [null, null, null];\n }\n\n if ($results->getTotal() < 1) {\n return [$results, null, null];\n }\n\n // Paging, we'll provide the URLs here, but it's up to the view\n // to display them.\n $searchPageUrl = ml_wpsearch_url();\n $nextLink = null;\n if ($results->getCurrentPage() < $results->getTotalPages()) {\n $nextLink = add_query_arg(array(\n 's' => urlencode($querytext),\n 'start' => $results->getNextStart(),\n 'pageLength' => $results->getPageLength(),\n ), $searchPageUrl);\n }\n\n $prevLink = null;\n if ($results->getCurrentPage() > 1) {\n $prevLink = add_query_arg(array(\n 's' => urlencode($querytext),\n 'start' => $results->getPreviousStart(),\n 'pageLength' => $results->getPageLength(),\n ), $searchPageUrl);\n }\n\n return [$results, $nextLink, $prevLink];\n}", "public function RoomsAvailablesSearchManger($start,$end,$max_person)\n\t\t{\n\t\t\t\t$sql = \"Select rooms.room_id, rooms.room_name,rooms.max_person,rooms.end_date\n\t\t\t\t\t\t\t\tFrom rooms\n\t\t\t\t\t\t\t\tWhere rooms.max_person >= '$max_person' AND rooms.room_id Not In (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSelect room_ids\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFrom bookings\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWhere booking_start_date <= '$end'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAnd DATE_ADD( booking_end_date, INTERVAL -1 DAY ) >= '$start'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tOrder By rooms.room_id\";\n\t\t\t$query = $this->db->query($sql);\n\t\t\treturn $query->result_array();\n\n \t\t}", "public function search(string $what, int $start = 1, int $end = 1): int|false {}", "public function search(string $keyword, int $start, int $end): string\n {\n // this would be slow on large arrays, but since the demo arrays are short it doesn't matter\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n $arr = [];\n $count = 0;\n if ($keyword === '') {\n foreach ($fs as $file) {\n if ($count >= $start && $count <= $end) {\n $file['path'] = $this->createPath($fs, $file);\n $arr[] = $file;\n }\n $count++;\n }\n } else {\n foreach ($fs as $file) {\n if (stripos($file['name'], $keyword) !== false) {\n if ($count >= $start && $count <= $end) {\n $file['path'] = $this->createPath($fs, $file);\n $arr[] = $file;\n }\n $count++;\n }\n }\n }\n return json_encode($arr);\n }", "public function getPages($pageRange)\n {\n $pageNumber = $this->current;\n $pageCount = $this->totalRecords;\n\n if ($pageRange > $pageCount) {\n $pageRange = $pageCount;\n }\n\n $delta = ceil($pageRange / 2);\n\n if ($pageNumber - $delta > $pageCount - $pageRange) {\n $lowerBound = $pageCount - $pageRange + 1;\n $upperBound = $pageCount;\n } else {\n if ($pageNumber - $delta < 0) {\n $delta = $pageNumber;\n }\n\n $offset = $pageNumber - $delta;\n $lowerBound = $offset + 1;\n $upperBound = $offset + $pageRange;\n }\n\n\t\treturn $this->getPagesInRange($lowerBound, $upperBound);\n }", "public function searchBookList($keyword)\n {\n return $this->bookDao->searchBookList($keyword);\n }", "public function getPageRange($range = 4)\n {\n $from = max(1, $this->getPage() - $range);\n $to = min($this->getPageCount(), $this->getPage() + $range);\n\n return range($from, $to);\n }", "function search_textbooks($db, $title, $isbn, $author)\n{\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \n\t\t\t\t\t\t\".$titlekey.\" LIKE :title and \".$isbnkey.\" LIKE :isbn and \n\t\t\t\t\t\t\".$authorkey.\" LIKE :author and removed=0\n\t\t\t\t\t\tORDER BY date_time DESC\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}", "public static function fromBindingPage($binding, $range)\n {\n if (is_array($range))\n {\n $from = $range[0];\n $to = $range[1];\n }\n else\n {\n $from = $range;\n $to = $range;\n }\n \n return Database::getInstance()->doTransaction(function() use ($binding, $from, $to)\n {\n $result = Query::select('bookId')\n ->from('Books')\n ->where('bindingId = :binding', 'lastPage >= :from', 'firstPage <= :to')\n ->orderBy('firstPage', 'ASC')\n ->execute(array(\n 'binding' => $binding->getBindingId(),\n 'from' => $from,\n 'to' => $to\n ));\n \n $books = array();\n foreach ($result as $book)\n {\n $books[] = new Book($book->getValue('bookId'));\n }\n \n return $books;\n });\n }", "public function search($terms, $page=1, $per_page=15)\n\t{\n\t\t$params = array(\n\t\t\t'q' => $terms,\n\t\t\t'start' => (($page - 1) * $per_page),\n\t\t\t'num' => $per_page,\n\t\t\t'output' => 'xml_no_dtd',\n\t\t\t'client' => 'google-csbe',\n\t\t\t'cx' => $this->site_search_key,\n\t\t\t'ie' => 'utf8',\n\t\t\t'oe' => 'utf8'\n\t\t);\n\n\t\t$url = 'http://www.google.com/search?' . http_build_query($params);\n\t\t$source = file_get_contents($url);\n\n\t\t$document = new \\DomDocument();\n\t\t$document->loadXml($source);\n\t\t$xpath = new \\DOMXpath($document);\n\t\t$results = new \\stdClass();\n\n\t\t$results->page = $page;\n\t\t$results->start = $xpath->evaluate('string(//RES/@SN)');\n\t\t$results->end = $xpath->evaluate('string(//RES/@EN)');\n\t\t$results->total_guess = $xpath->evaluate('string(//RES/M)');\n\t\t$results->has_more = $xpath->evaluate('boolean(//NU)');\n\t\t$results->suggestion = NULL;\n\t\t$results->results = array();\n\n\t\tif ($suggestion = $xpath->evaluate('string(//Spelling/Suggestion)')) {\n\t\t\t$results->suggestion = $suggestion;\n\t\t}\n\n\t\tforeach ($xpath->query('//RES/R') as $result) {\n\t\t\t$results->results[] = (object) array(\n\t\t\t\t'title' => $xpath->evaluate('string(T)', $result),\n\t\t\t\t'excerpt' => $xpath->evaluate('string(S)', $result),\n\t\t\t\t'url' => $xpath->evaluate('string(U)', $result)\n\t\t\t);\n\t\t}\n\t\t\n\t\treturn $results;\n\t}", "public function getPagesInRange($lowerBound, $upperBound) {\n $lowerBound = $this->normalizePageNumber($lowerBound);\n $upperBound = $this->normalizePageNumber($upperBound);\n\n $pages = array();\n\n for ($pageNumber = $lowerBound; $pageNumber <= $upperBound; $pageNumber++) {\n $pages[$pageNumber] = $pageNumber;\n }\n\n return $pages;\n }" ]
[ "0.62910104", "0.6289996", "0.54742336", "0.539556", "0.5195375", "0.5137985", "0.51248515", "0.5013186", "0.49527684", "0.49359852", "0.48796913", "0.48467934", "0.48402098", "0.4797571", "0.4782476", "0.4759462", "0.47467378", "0.47342816", "0.47342816", "0.4730584", "0.47231546", "0.47093228", "0.46986055", "0.4687405", "0.46854004", "0.46852288", "0.46573323", "0.46559978", "0.46533638", "0.46531105" ]
0.7010381
0
/ search_inventory: Searches a user's inventory for a textbook. It uses the same method as search_textbooks() except it's applied to one user's textbooks
function search_inventory($db, $seller_id, $title, $isbn, $author) { /* Copy and pasted code from "search_textbooks" I can't just wrap it in another function because of how the prepared statement works */ $titlekey = ""; //sql colomn name $isbnkey = ""; //sql column name $authorkey = ""; //sql column name $titlevalue = ""; // sql column value $isbnvalue = ""; // sql column value $authorvalue = ""; // sql column value /* All empty strings returns nothing */ if($title == "" && $isbn == "" && $author == "") { $titlekey = "1"; $isbnkey = "1"; $authorkey = "1"; $titlevalue = "0"; $isbnvalue = "0"; $authorvalue = "0"; } else // If not an empty search { if($title == "") // No search by title { $titlekey = '1'; $titlevalue = '1'; } else // Include search by title { $titlekey = 'title'; $titlevalue = "%".$title."%"; } if($isbn == "") // No search by isbn { $isbnkey = '1'; $isbnvalue = '1'; } else // include search by isbn { $isbnkey = 'isbn'; $isbnvalue = "%".$isbn."%"; } if($author == "") // no search by author { $authorkey = '1'; $authorvalue = '1'; } else // include search by author { $authorkey = 'author'; $authorvalue = "%".$author."%"; } } /* Run the query */ $sql = "SELECT * FROM textbooks where ".$titlekey." LIKE :title and ".$isbnkey." LIKE :isbn and ".$authorkey." LIKE :author and seller_id = :seller_id ORDER BY date_time DESC"; $st = $db->prepare($sql); $st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue, ':seller_id'=>$seller_id)); $us = $st->fetchAll(); return $us; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function search_textbooks($db, $title, $isbn, $author)\n{\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \n\t\t\t\t\t\t\".$titlekey.\" LIKE :title and \".$isbnkey.\" LIKE :isbn and \n\t\t\t\t\t\t\".$authorkey.\" LIKE :author and removed=0\n\t\t\t\t\t\tORDER BY date_time DESC\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}", "function searchRecipe($text=false){\n\t\t$filter=false;\n\t\tif($text!=false){\n\t\t\t$filter=\"Name like '%$text%'\";\n\t\t}\n\t\t\n\t\treturn $this->getRecipe($filter);\n\t}", "function searchInventory ($searchValue) {\n global $db;\n \n \n //$stmt = $db->prepare(\"SELECT * FROM schools WHERE $column LIKE :search\");\n\n \n \n $results = [];\n $stmt = $db->prepare(\"SELECT idItem, `name`, amount, unitPrice, salesPrice, parAmount FROM inventory WHERE name LIKE :search\");\n $search = '%'.$searchValue.'%';\n $binds = array(\n \":search\" => $search\n );\n\n if ( $stmt->execute($binds) && $stmt->rowCount() > 0 ) {\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\n\n }\n\n return ($results);\n }", "function searchRecipeInBasket($recipe){\n if(isConnected())\n {\n $userDataFileName = $_SESSION[\"userDataFileName\"];\n $userDataFilePath = \"../data/\" . $userDataFileName;\n $userDataFile = fopen($userDataFilePath, \"r\");\n $userData = unserialize(fgets($userDataFile));\n fclose($userDataFile);\n return array_search($recipe, $userData[\"basket\"]);\n\n }\n else\n {\n return array_search($recipe, $_SESSION[\"notConnectedBasket\"]);\n }\n}", "public function search_lookbook() {\n\n\t\tif ( ! current_user_can( 'manage_woocommerce' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$keyword = isset($_GET['keyword'])? sanitize_text_field($_GET['keyword']):'';\n\n\t\tif ( empty( $keyword ) ) {\n\t\t\tdie();\n\t\t}\n\t\t$arg = array(\n\t\t\t'post_status' => 'publish',\n\t\t\t'post_type' => 'woocommerce-lookbook',\n\t\t\t'posts_per_page' => 50,\n\t\t\t's' => $keyword\n\n\t\t);\n\t\t$the_query = new WP_Query( $arg );\n\t\t$found_products = array();\n\t\tif ( $the_query->have_posts() ) {\n\t\t\twhile ( $the_query->have_posts() ) {\n\t\t\t\t$the_query->the_post();\n\n\t\t\t\t$product = array( 'id' => get_the_ID(), 'text' => get_the_title() );\n\t\t\t\t$found_products[] = $product;\n\t\t\t}\n\t\t}\n\t\twp_send_json( $found_products );\n\t\tdie;\n\t}", "function ciniki_ags_exhibitorItemSearch($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'tnid'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'),\n 'start_needle'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Search String'),\n 'exhibitor_id'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Exhibitor'),\n 'exhibit_id'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Exhibit'),\n 'limit'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Limit'),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n\n //\n // Check access to tnid as owner, or sys admin.\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'ags', 'private', 'checkAccess');\n $rc = ciniki_ags_checkAccess($ciniki, $args['tnid'], 'ciniki.ags.exhibitorItemSearch');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Load maps\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'ags', 'private', 'maps');\n $rc = ciniki_ags_maps($ciniki);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $maps = $rc['maps'];\n\n $args['start_needle'] = preg_replace(\"/ /\", '%', $args['start_needle']);\n \n //\n // Get the list of items\n //\n if( isset($args['exhibit_id']) && $args['exhibit_id'] != '' ) {\n $strsql = \"SELECT ciniki_ags_items.id, \"\n . \"ciniki_ags_items.exhibitor_id, \"\n . \"ciniki_ags_items.exhibitor_code, \"\n . \"ciniki_ags_items.code, \"\n . \"ciniki_ags_items.name, \"\n . \"ciniki_ags_items.tag_info, \"\n . \"ciniki_ags_items.permalink, \"\n . \"ciniki_ags_items.status, \"\n . \"ciniki_ags_items.status AS status_text, \"\n . \"ciniki_ags_items.flags, \"\n . \"ciniki_ags_items.flags AS flags_text, \"\n . \"(ciniki_ags_items.flags&0x06) AS online_flags_text, \"\n . \"ciniki_ags_items.unit_amount AS unit_amount_display, \"\n . \"ciniki_ags_items.unit_discount_amount AS unit_discount_amount_display, \"\n . \"ciniki_ags_items.unit_discount_percentage AS unit_discount_percentage_display, \"\n . \"ciniki_ags_items.fee_percent AS fee_percent_display, \"\n . \"ciniki_ags_items.taxtype_id, \"\n . \"IFNULL(ciniki_ags_exhibit_items.exhibit_id, 0) AS exhibit_id, \"\n . \"IFNULL(ciniki_ags_exhibit_items.inventory, 0) AS inventory, \"\n . \"IFNULL(tags.tag_name, '') as categories \"\n . \"FROM ciniki_ags_items \"\n . \"LEFT JOIN ciniki_ags_exhibit_items ON (\"\n . \"ciniki_ags_items.id = ciniki_ags_exhibit_items.item_id \"\n . \"AND ciniki_ags_exhibit_items.exhibit_id = '\" . ciniki_core_dbQuote($ciniki, $args['exhibit_id']) . \"' \"\n . \"AND ciniki_ags_exhibit_items.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \") \" \n . \"LEFT JOIN ciniki_ags_item_tags AS tags ON (\" \n . \"ciniki_ags_exhibit_items.item_id = tags.item_id \" \n . \"AND tags.tag_type = 20 \" \n . \"AND tags.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \") \" \n . \"WHERE ciniki_ags_items.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"AND ciniki_ags_items.exhibitor_id = '\" . ciniki_core_dbQuote($ciniki, $args['exhibitor_id']) . \"' \"\n . \"AND (\"\n . \"name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR exhibitor_code LIKE '%\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR exhibitor_code LIKE '%0\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%-\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%-0\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%00\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \"\n . \"\";\n } else {\n $strsql = \"SELECT ciniki_ags_items.id, \"\n . \"ciniki_ags_items.exhibitor_id, \"\n . \"ciniki_ags_items.exhibitor_code, \"\n . \"ciniki_ags_items.code, \"\n . \"ciniki_ags_items.name, \"\n . \"ciniki_ags_items.tag_info, \"\n . \"ciniki_ags_items.permalink, \"\n . \"ciniki_ags_items.status, \"\n . \"ciniki_ags_items.status AS status_text, \"\n . \"ciniki_ags_items.flags, \"\n . \"ciniki_ags_items.flags AS flags_text, \"\n . \"(ciniki_ags_items.flags&0x06) AS online_flags_text, \"\n . \"ciniki_ags_items.unit_amount AS unit_amount_display, \"\n . \"ciniki_ags_items.unit_discount_amount AS unit_discount_amount_display, \"\n . \"ciniki_ags_items.unit_discount_percentage AS unit_discount_percentage_display, \"\n . \"ciniki_ags_items.fee_percent AS fee_percent_display, \"\n . \"ciniki_ags_items.taxtype_id, \"\n . \"0 AS exhibit_id, \"\n . \"0 AS inventory, \"\n . \"'' AS categories \"\n . \"FROM ciniki_ags_items \"\n . \"WHERE ciniki_ags_items.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"AND ciniki_ags_items.exhibitor_id = '\" . ciniki_core_dbQuote($ciniki, $args['exhibitor_id']) . \"' \"\n . \"AND (\"\n . \"name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '%-\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR exhibitor_code LIKE '%\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR exhibitor_code LIKE '%0\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%-\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%-0\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '%00\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \"\n . \"\";\n }\n if( isset($args['limit']) && is_numeric($args['limit']) && $args['limit'] > 0 ) {\n $strsql .= \"LIMIT \" . ciniki_core_dbQuote($ciniki, $args['limit']) . \" \";\n } else {\n $strsql .= \"LIMIT 25 \";\n }\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');\n $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.ags', array(\n array('container'=>'items', 'fname'=>'id', \n 'fields'=>array('id', 'exhibitor_id', 'exhibitor_code', 'tag_info', 'code', 'name', 'permalink', \n 'status', 'status_text', 'flags', 'flags_text', 'online_flags_text',\n 'unit_amount_display', 'unit_discount_amount_display', 'unit_discount_percentage_display', \n 'fee_percent_display', 'taxtype_id', 'exhibit_id', 'inventory', 'categories'),\n 'maps'=>array('status_text'=>$maps['item']['status']),\n 'dlists'=>array('categories'=>', '),\n 'flags'=>array('flags_text'=>$maps['item']['flags'],\n 'online_flags_text'=>$maps['item']['flags'],\n ),\n 'naprices'=>array('unit_amount_display', 'unit_discount_amount_display'),\n 'percents'=>array('unit_discount_percentage_display', 'fee_percent_display'),\n ),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['items']) ) {\n $items = $rc['items'];\n $item_ids = array();\n foreach($items as $iid => $item) {\n $item_ids[] = $item['id'];\n }\n } else {\n $items = array();\n $item_ids = array();\n }\n\n return array('stat'=>'ok', 'items'=>$items, 'nplist'=>$item_ids);\n}", "public function search(){\r\n\t\t//Test if the POST parameters exist. If they don't present the user with the\r\n\t\t//search controls/form\r\n\t\tif(!isset($_POST[\"search\"])){\r\n\t\t\t$this->template->display('search.html.php');\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t//Get the recipe from the database\r\n\t\t$recipes = Recipe::search($_POST[\"search\"]);\r\n\t\t//If successful and the count is equal to one (as desired)\r\n\t\t//set the recipe object in the template to be displayed\r\n\t\t$this->template->recipes = $recipes;\r\n\t\r\n\t\t$this->template->display('results.html.php');\r\n\t}", "private function search_items()\n\t\t{\n\t\t\t$inputsearch = str_replace(\"\\\\\",\"\\\\\\\\\",$this->inputsearch); // SRX_BACKSLASH_FIX_ISSUE\n\t\t\tif(substr($this->inputsearch,0,1) == \"\\\\\")\n\t\t\t{\n\t\t\t\t$pre_jocker = '';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$pre_jocker = '%';\n\t\t\t}\n\t\t\t\n\t\t\t$query = \"\tSELECT\n\t\t\t\t\t\t\t`MTN`.`id` AS 'id'\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t`\".$this->tree_node.\"` `MTN`,\n\t\t\t\t\t\t\t`\".$this->tree_caption.\"` `MTC`\n\t\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t\t\tAND `MTN`.`id` = `MTC`.`id`\n\t\t\t\t\t\t\tAND `MTN`.`application_release` = `MTC`.`application_release`\n\t\t\t\t\t\t\tAND `MTN`.`application_release`\t= '\".$this->application_release.\"'\n\t\t\t\t\t\t\tAND `MTC`.`language` = '\".$this->language.\"'\n\t\t\t\t\t\t\tAND `MTC`.`title`\t\tlike '\".$pre_jocker.$this->mysql_protect($inputsearch).\"%'\n\t\t\t\t\t\";\n\t\t\t$result = $this->link_mt->query($query);\n\t\t\t\n\t\t\t// Clear list\n\t\t\t$this->listexpand = ''; \n\t\t\t$this->listhighlight = '';\n\t\t\t\n\t\t\t$this->count_item_found = 0;\n\t\t\t\n\t\t\twhile ($row = $result->fetch_array(MYSQLI_ASSOC))\n\t\t\t{\n\t\t\t\t// Prepare array for full expansion\n\t\t\t\t$this->listexpand[$row['id']] = true;\n\t\t\t\t\n\t\t\t\t// Build array to highlight item\n\t\t\t\t$this->listhighlight[$row['id']] = true;\n\t\t\t\t\n\t\t\t\t$this->count_item_found = $this->count_item_found + 1; // Count number of entries in current search\n\t\t\t}\n\n\t\t\tif(!$this->count_item_found)\n\t\t\t{\n\t\t\t\t// Search launched but no item found\n\t\t\t\t$this->count_item_found = 'NoItemFound';\n\t\t\t}\n\t\t\t\n\t\t\t$this->build_full_array_expansion();\n\t\t\t\n\t\t\t//$_SESSION[$this->ssid]['MT'][$this->internal_id][\"expandlist\"] = $this->listexpand;\n\t\t}", "public function search(Request $request, Item $items): Renderable\n {\n $items = $items->userLocation()->where('item_code', 'LIKE', \"%{$term}%\")\n ->orWhere('name', 'LIKE', \"%{$term}%\");\n\n return view('inventory.index', compact('items'));\n }", "function search() {}", "function search_textbook_range($db, $title, $isbn, $author, $numstart, $numresults)\n{\n\t$titlekey = \"\"; //sql colomn name\n\t$isbnkey = \"\"; //sql column name \n\t$authorkey = \"\"; //sql column name\n\t$titlevalue = \"\"; // sql column value\n\t$isbnvalue = \"\"; // sql column value\n\t$authorvalue = \"\"; // sql column value\n\n\t/* All empty strings returns nothing */\n\tif($title == \"\" && $isbn == \"\" && $author == \"\")\n\t{\n\t\t$titlekey = \"1\";\n\t\t$isbnkey = \"1\";\n\t\t$authorkey = \"1\";\n\t\t$titlevalue = \"0\";\n\t\t$isbnvalue = \"0\";\n\t\t$authorvalue = \"0\";\n\t}\n\telse // If not an empty search\n\t{\n\n\t\tif($title == \"\") // No search by title\n\t\t{\n\t\t\t$titlekey = '1';\n\t\t\t$titlevalue = '1';\n\t\t}\n\t\telse // Include search by title\n\t\t{\n\t\t\t$titlekey = 'title';\n\t\t\t$titlevalue = \"%\".$title.\"%\"; \n\t\t}\n\n\t\tif($isbn == \"\") // No search by isbn\n\t\t{\n\t\t\t$isbnkey = '1';\n\t\t\t$isbnvalue = '1';\n\t\t}\n\t\telse // include search by isbn\n\t\t{\n\t\t\t$isbnkey = 'isbn';\n\t\t\t$isbnvalue = \"%\".$isbn.\"%\";\n\t\t}\n\n\t\tif($author == \"\") // no search by author\n\t\t{\n\t\t\t$authorkey = '1';\n\t\t\t$authorvalue = '1';\n\t\t}\n\t\telse // include search by author\n\t\t{\n\t\t\t$authorkey = 'author';\n\t\t\t$authorvalue = \"%\".$author.\"%\";\n\t\t}\n\t}\n\n\t\t/* Run the query */\n\t\t$sql = \"SELECT * FROM textbooks where \n\t\t\t\t\t\t\".$titlekey.\" LIKE :title and \".$isbnkey.\" LIKE :isbn and \n\t\t\t\t\t\t\".$authorkey.\" LIKE :author and removed=0\n\t\t\t\t\t\tORDER BY date_time DESC LIMIT $numstart, $numresults\";\n\n\t\t$st = $db->prepare($sql);\n\t\t$st->execute(array(':title' => $titlevalue, ':isbn'=>$isbnvalue, ':author'=>$authorvalue));\n\t\t$us = $st->fetchAll();\n\t\treturn $us;\n}", "public function search($input)\n {\n $client = new Client();\n try {\n $res = $client->get('https://www.googleapis.com/books/v1/volumes',\n [\n 'query' => [\n 'key' => config('services.googleBooks.key'),\n 'q' => $input,\n ],\n ]\n );\n } catch (\\Exception $e) {\n return response()->json(['errors' => $e->getMessage()], 422);\n }\n $res->getStatusCode(); // 200\n $response = json_decode($res->getBody());\n $results = [];\n if (!$response || !isset($response->items)) {\n return response()->json($response);\n }\n foreach ($response->items as $item) {\n $formattedResponse = $this->transformToJustBookrFormat($item, request('save', false));\n if ($formattedResponse) {\n array_push($results, $formattedResponse);\n }\n }\n if (request('format', 'JustBookr') == 'google') {\n return response()->json($response);\n }\n\n return response()->json($results);\n }", "public function searchBook()\n\t{\n\t\tif (cookie('staffAccount') != '') {\n\t\t\t$text = $_POST['text'];\n\t\t\t$type = $_POST['type'];\n\t \t\t//$return = array();\n\t\t\t$book = D('Book_species');\n\t\t\t$sql = \"SELECT * FROM lib_book_species as a join\n\t\t\t\t\t(SELECT COUNT(*) as number, isbn FROM lib_book_unique \n\t\t\t \t\twhere book_id not in(select book_id from lib_remove)\n\t\t\t \t\tGROUP BY isbn) AS b using(isbn)\n\t\t\t \t\twhere {$type} like '%{$text}%' and number!=0 ORDER BY species_id DESC;\";\n\t\t\tif ($type == 1) {\n\t\t\t\t$bkid = intval($text);\n\t\t\t\t$sql = \"select * from lib_book_species join (select isbn,count(*)\n\t\t\t\t \t\tas number from lib_book_unique group by isbn) as a using(isbn) \n\t\t\t\t\t\twhere isbn in (select isbn from lib_book_unique \n\t\t\t\t\t\twhere book_id = {$bkid}) and {$bkid} not in \n\t\t\t\t\t\t(select book_id from lib_remove)\";\n\t\t\t}\n\n\n\t\t\t$return = $book->query($sql);\n\t\t\tif ($return) {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'success',\n\t\t\t\t\t'data' => json_encode($return)\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t} else {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t'msg' => 'No result!'\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t}\n\t\t} else {\n\t\t\t$json = json_encode(array(\n\t\t\t\t'code' => 'fail',\n\t\t\t\t'msg' => 'Please Login!'\n\t\t\t));\n\t\t\techo $json;\n\t\t}\n\n\t}", "public function SearchCombatItems() {\n\t\t\t// Declare Classes\n\t\t\t$RepItem\t\t\t= new RepItem();\n\t\t\t$ModItem\t\t\t= new ModItem();\n\t\t\t// Intialize variables\n\t\t\t$return\t\t\t\t= '<br />(no Combat Items found)';\n\t\t\t// Get first 20 entries\n\t\t\t$result\t\t\t\t= $RepItem->getAllCombatItems(20);\n\t\t\t// If there are entries\n\t\t\tif ($result) {\n\t\t\t\t// Get Field names\n\t\t\t\t$RepQuestion\t= new RepQuestion();\n\t\t\t\t$fields\t\t\t= $RepQuestion->getAllFields();\n\t\t\t\t// Separate returned data an paging info\n\t\t\t\t$rows\t\t\t= $result[0];\n\t\t\t\t$paging_info\t= $result[1];\n\t\t\t\t// Model Result\n\t\t\t\t$return\t\t\t= $ModItem->listCombatItems($rows, $fields, 'i.id', 'ASC');\n\t\t\t\t// Define Pager info\n\t\t\t\t$pager\t\t\t= Pager::pagerOptions($paging_info, 'items', 'partialCombatResult');\n\t\t\t}\n\t\t\t// Define sub menu selection\n\t\t\t$GLOBALS['menu']['items']['opt2_css'] = 'details_item_on';\n\t\t\t// Prepare info to be displayed\n\t\t\tView::set('pager', $pager);\n\t\t\tView::set('return', $return);\n\t\t\t// render view\n\t\t\tView::render('usersSearch');\n \t\t}", "public function search();", "public function search();", "public function search($term = null);", "public function searchAction()\n {\n //get the barcode, identifier and action for the product scanned or entered.\n $code = $this->getRequest()->getPost('input');\n $identifier = $this->getRequest()->getPost('identifier');\n\n Mage::log($identifier, null, 'identifier.log');\n\n if(isset($code) && !empty($identifier))\n {\n $product = Mage::getModel('barcodescanner/find')->findProduct($code, $identifier);\n } else {\n $product = \"Product not found, please try a different code\";\n }\n\n $this->getResponse()->setBody(json_encode($product));\n\n }", "public function search() {\r\n //retrieve query terms from search form\r\n $query_terms = trim($_GET['query-terms']);\r\n\r\n //if search term is empty, list all vacations\r\n if ($query_terms == \"\") {\r\n $this->index();\r\n }\r\n\r\n //search the database for matching movies\r\n $vacations = $this->vacation_model->search_vacation($query_terms);\r\n\r\n if ($vacations === false) {\r\n //handle error\r\n $message = \"An error has occurred.\";\r\n $this->error($message);\r\n return;\r\n }\r\n //display matched movies\r\n $search = new VacationSearch();\r\n $search->display($query_terms, $vacations);\r\n }", "function search()\n\t{}", "function search()\n\t{}", "function searchSongs($term, $database) {\n\t// Get list of books\n\t$term = $term . '%';\n\t$sql = file_get_contents('sql/getSongs.sql');\n\t$params = array(\n\t\t'term' => $term\n\t);\n\t$statement = $database->prepare($sql);\n\t$statement->execute($params);\n\t$songs = $statement->fetchAll(PDO::FETCH_ASSOC);\n\treturn $books;\n}", "function spectra_search_tx ($search_text)\n\t{\n\t\techo \"\t\t<h2> Transaction Search Results: </h2> \\n\\n\";\n\n\t\t$tx = mysqli_getset ($GLOBALS[\"tables\"][\"tx\"], \"`txid` LIKE '%\".$_POST[\"searchtext\"].\"%'\");\n\n\t\tif (!isset ($tx[\"data\"]) || $tx[\"data\"] == \"\")\n\t\t{\n\t\t\techo \"\t\t<p class=\\\"search_dark\\\"> No Matching Transaction Records </p> \\n\\n\";\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\techo \"\t\t<p class=\\\"search_dark\\\"> Transaction IDs Containing \\\"\".substr ($_POST[\"searchtext\"], 0, 32).\" ...\\\": </p> \\n\\n\";\n\n\t\t\tforeach ($tx[\"data\"] as $transaction)\n\t\t\t{\n\t\t\t\techo \"\t\t<p> \\n\";\n\t\t\t\techo \"\t\t<a href=\\\"tx.php?tx=\".$transaction[\"txid\"].\"\\\" title=\\\"Transaction Detaiil Page\\\"> \\n\";\n\t\t\t\techo \"\t\t\t\".$transaction[\"txid\"].\"\\n\";\n\t\t\t\techo \"\t\t</a> \\n\";\n\t\t\t\techo \"\t\t</p> \\n\\n\";\n\t\t\t}\n\t\t}\n\t}", "public function search($searchText){\n\n $sql = $this->db->select()\n ->from(\"job\")\n ->join(array(\"c\"=>\"categories\"), \"job.category_id=c.category_id\")\n ->join(array(\"com\"=>\"company\"), \"job.user_id=com.user_id\")\n ->join(array(\"ci\"=>\"city\"), \"job.city_id=ci.city_id\")\n ->where(\"job_name LIKE '%$searchText%' OR com_name LIKE '%$searchText%' or city_name LIKE '%$searchText%'\")\n// ->where(\" job_close_date > NOW() \")\n ;\n\n return $this->executeQuery($sql)->toArray();\n }", "public abstract function search_items(\\WP_REST_Request $request);", "public function searchBook(string $bookName)\n {\n }", "public function getInventoryById($id_inventory)\n\t{\n\t\t$sql = new Sql($this->dbAdapter);\n\t\t$select = $sql->select();\n\t\t$select\n\t\t\t->columns(array('id_inventories', 'types_id_types', 'id_acl_users', 'id_department', 'article', 'amount', 'brand', 'serialnumber', 'material', 'model', 'description', 'id_employee', 'state', 'id_product', 'capacity', 'photofile', 'chilled_dry'))\n\t\t\t->from(array('i' => $this->table))\n\t\t\t->join(array('u' => 'iof_users'), 'i.id_acl_users = u.user_id', array('name', 'surname', 'lastname'), 'Left')\n\t\t\t->join(array('d' => 'department'), 'i.id_department = d.id_department', array('d_name'), 'LEFT')\n\t\t\t->join(array('t' => 'types'), 'i.types_id_types = t.id_types', array('name_type' => 'description'), 'LEFT')\n\t\t\t->join(array('i_p' => 'inventories_photos'), 'i.id_inventories = i_p.id_inventory', array('name_photo'), 'LEFT')\n\t\t\t->where(array('i.id_inventories' => $id_inventory));\n\t\n\t\t$selectString = $sql->getSqlStringForSqlObject($select);\n\t\t$execute = $this->dbAdapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);\n\t\t$result = $execute->toArray();\n\t\treturn $result;\n\t}", "public function show(Inventory $inventory)\n {\n //\n }", "function search()\n\t{\n\t\t$search=$this->input->post('search');\n\t\t\t$data_rows=get_temp_manage_table_data_rows1($this->Giftcard->search($search),$this);\n\t\t\techo $data_rows;\n\t}", "public function search(){}" ]
[ "0.5720042", "0.5712443", "0.5507576", "0.54414135", "0.543814", "0.53965425", "0.5394125", "0.5389532", "0.5385014", "0.5352729", "0.53086275", "0.5294403", "0.5278206", "0.5275212", "0.52470326", "0.52470326", "0.5230554", "0.52074814", "0.5174617", "0.5142767", "0.5142767", "0.5137635", "0.5132778", "0.5132668", "0.5118306", "0.5115095", "0.51043624", "0.50699794", "0.50569606", "0.5033095" ]
0.6784748
0
/ get_message_inbox: returns and array of message records that are associated with a user.
function get_message_inbox($db, $user_id) { $sql = "SELECT * FROM messages where to_id= :to_id ORDER BY date_time DESC"; $st = $db->prepare($sql); $st->execute(array(':to_id'=>$user_id)); $us = $st->fetchAll(); return $us; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function findInboxByUser($user)\n {\n return $this->getEntityManager()\n ->createQuery(\n 'SELECT m\n FROM WHAAMPrivateApplicationNotificationBundle:Message m\n JOIN m.recipientUsers r\n WHERE r = :user\n ORDER BY m.createdAt DESC\n '\n )\n ->setParameter('user', $user)\n ->getResult();\n }", "public function getInboxMessages() {\n\t\t$urlInboxMessages = \"http://www.reddit.com/message/messages/.json\";\n\t\treturn $this->runCurl ( $urlInboxMessages );\n\t\t// Surely: return $this->getRawJSON('message/messages/'); is preferable.\n\t}", "function getInboxMessage() {\n $sql = \"SELECT * FROM `mail` WHERE receiver_id = ?\";\n return getAll($sql, [getLogin()['mid']]);\n}", "function inbox() {\n $this->title = 'Inbox';\n $this->pagination = new Pagination(array('items_per_page' => 15, 'total_items' => ORM::factory('message')->count_by_user($this->user->id)));\n $limit = $this->pagination->items_per_page;\n $offset = $this->pagination->sql_offset();\n $this->messages = ORM::factory('message')->find_by_user($this->user->id, $limit, $offset);\n }", "private function _fetchEmailsFromInbox()\n {\n // refresh the cache\n $this->imapConnection->getResource()->clearLastMailboxUsedCache();\n $messages = $this->inbox->getMessages();\n if ($messages instanceof \\ArrayIterator) {\n $messages = iterator_to_array($messages);\n }\n\n return $messages;\n }", "public function listAllByUser(UserModel $user)\n {\n /* @var $repo \\Xpto\\Repository\\Inbox\\Inbox */\n $repo = new InboxRepository($this->em);\n\n /* @var $inbox \\Xpto\\Entity\\Inbox\\Inbox */\n $inbox = $repo->findAllWithUser($user);\n\n return $inbox;\n }", "public function getInbox()\n {\n return $this->_getAndParse($this->_serverPath['inbox'], null);\n }", "function fun_getUserInboxArr($user_id, $extra_parameter=''){\n\t\t$sql = \"SELECT A.message_id, \n\t\t\t\tA.message_type,\n\t\t\t\tA.message_subject,\n\t\t\t\tFROM_UNIXTIME(A.message_created_on, '%m/%d/%Y') AS message_created_on,\n\t\t\t\tA.message_subject,\n\t\t\t\tA.message_reciever_rflag,\n\t\t\t\tA.message_reciever_dflag,\n\t\t\t\tB.user_fname,\n\t\t\t\tB.user_lname,\n\t\t\t\tC.messages_type_name\n\t\tFROM \" . TABLE_USER_MESSAGES . \" AS A \n\t\tINNER JOIN \" . TABLE_USERS . \" AS B ON A.message_sender_id = B.user_id \n\t\tINNER JOIN \" . TABLE_USER_MESSAGE_TYPE . \" AS C ON A.message_type = C.messages_type_id \n\t\tWHERE A.message_reciever_id='\".$user_id.\"' \";\n\t\tif($extra_parameter != \"\"){\n\t\t\t$sql .= \" \".$extra_parameter;\t\t\n\t\t}\n\t\telse{\n\t\t\t$sql .= \"ORDER BY A.message_created_on\";\t\t\n\t\t}\n\n\t\t$rs = $this->dbObj->createRecordset($sql);\n\t\treturn $arr = $this->dbObj->fetchAssoc($rs);\t\t\n\t}", "public function getInboxByUser($userId, $perPage, $page);", "function getUserMessages($username){\n\t\t$username = escapeQuery($username);\n\t\t$query = \"SELECT M.message_id, U1.username AS fromUser, U2.username AS toUser, M.messageTitle, M.messageText\n\t\t\tFROM Messages AS M\n\t\t\tINNER JOIN User AS U1 ON M.fromUserId = U1.user_id\n\t\t\tINNER JOIN User AS U2 ON M.toUserId = U2.user_id\n\t\t\tWHERE U2.username = '$username'\";\n\t\t\n\t\t$result = doQuery($query);\n\t\t\n\t\t// save query results in an array\n\t\t$result_array = array();\n\t\twhile($row = mysqli_fetch_assoc($result))\n\t\t{\n \t\t$result_array[] = $row;\n\t\t}\n\t\t\n\t\treturn $result_array;\n\t}", "public function inbox($userid, $order = 'DESC') {\n $this->getDbCriteria()->mergeWith(array(\n 'select' => 'm.message_id, m.sender_id, \n\t\t\tm.text, m.created, m.sender_del, m.sender_read,\n m.sender_flag, mr.recipient_flag as recipient_flag,\n mr.recipient_read as recipient_read,\n mr.recipient_id as recipient, \n ms.created as is_replied',\n 'alias' => 'm',\n 'join' => \" INNER JOIN {{mailbox_conversation}} AS c ON(c.conversation_id=m.conversation_id) \n INNER JOIN {{mailbox_interlocutor}} as i ON (i.conversation_id=c.conversation_id) \n\t\t\tLEFT JOIN (\n\t\t\t\tSELECT conversation_id, created FROM {{mailbox_message}} \n\t\t\t) AS ms ON(ms.conversation_id=m.conversation_id AND ms.created > m.created) \n LEFT JOIN (\n SELECT * FROM {{mailbox_recipient}} \n ORDER BY message_id DESC \n ) as mr ON (mr.message_id=m.message_id)\n\t\t\t\",\n 'condition' => 'c.initiator_id=:userid AND ((m.sender_id=:userid AND m.sender_del=0 AND m.sender_spam=0) OR (mr.recipient_id=:userid AND mr.recipient_del=0 AND mr.recipient_spam=0)) OR \n i.interlocutor_id=:userid AND ((m.sender_id=:userid AND m.sender_del=0 AND m.sender_spam=0) OR (mr.recipient_id=:userid AND mr.recipient_del=0 AND mr.recipient_spam=0))',\n 'order' => \"m.created \" . $order,\n 'params' => array(':userid' => $userid),\n ));\n return $this;\n }", "public function actionInbox(){\n $user_id = \\Yii::$app->user->getId();\n $user = Users::find()->where(['user_id'=>$user_id])->one();\n //$messages = Message::find()->where(['to_user'=>$user_id])->orderBy('datetimestamp DESC')->all();\n $sql = \"SELECT * FROM (SELECT * FROM message WHERE to_user = $user_id AND (status != 0 AND status != $user_id) ORDER BY datetimestamp DESC) msg GROUP BY msg.thread_id ORDER BY msg.datetimestamp DESC\";\n $messages = Message::findbySql($sql)->all();\n $sql = \"SELECT * FROM (SELECT * FROM message WHERE from_user = $user_id AND (status != 0 AND status != $user_id) ORDER BY datetimestamp DESC) msg GROUP BY msg.thread_id ORDER BY msg.datetimestamp DESC\";\n $sent = Message::findbySql($sql)->all();\n return $this->render('messages', ['user'=>$user, 'messages'=>$messages, 'sent'=>$sent]);\n }", "function getAllMessages(){\n\t\t$query = \"SELECT M.message_id, U1.username AS fromUser, U2.username AS toUser, M.messageTitle, M.messageText\n\t\t\tFROM Messages AS M\n\t\t\tINNER JOIN User AS U1 ON M.fromUserId = U1.user_id\n\t\t\tINNER JOIN User AS U2 ON M.toUserId = U2.user_id\";\n\t\t$result = doQuery($query);\n\t\t\n\t\t// save query results in an array\n\t\t$result_array = array();\n\t\twhile($row = mysqli_fetch_assoc($result))\n\t\t{\n \t\t$result_array[] = $row;\n\t\t}\n\t\t\n\t\treturn $result_array;\n\t}", "public function action_inbox()\n\t{\t\tif ($this->id)\n\t\t\treturn $this->action_inbox_read();\n\n\t\t$messages = ORM::factory('Message')\n\t\t\t->where('recipient_id', '=', $this->user->id)\n\t\t\t->order_by('read', 'asc')\n\t\t\t->order_by('timestamp', 'desc')\n\t\t\t->find_all()\n\t\t\t->as_array();\n\n\t\t$this->set_layout();\n\t\t$this->template->header->title = $this->user->name.' / '.__('Inbox');\n\t\t$this->template->content->active = 'Inbox';\n\t\t$this->template->content->body = View::factory('pages/messages/inbox')\n\t\t\t->bind('messages', $messages)\n\t\t\t->bind('link_inbox', $this->link_inbox);\n\t}", "public function getInbox(Request $request) {\n $user = $this->getCurrentUser();\n\n // query inbox\n $inboxes = Inbox::where('deleted_by', '!=', $user->id)\n ->where(function ($query) use ($user) {\n $query->where('user_id', $user->id);\n $query->orWhere('winner_id', $user->id);\n })\n ->get();\n\n // add item data to inbox\n $aryInbox = array();\n\n foreach ($inboxes as $inbox) {\n $inboxData = $inbox;\n $inboxData['item'] = $inbox->item;\n\n $aryInbox[] = $inboxData;\n }\n\n return $aryInbox;\n }", "public function selectMessagesFromUser($userid) {\n $result = $this->sdb->query(\n 'select m.*, to_char(m.time_sent, \\'YYYY-MM-DD\"T\"HH24:MI:SS\\') as sent_date from messages m\n where from_user = $1 order by m.time_sent desc',\n array($userid));\n\n $all = array();\n while ($row = $this->sdb->fetchrow($result)){\n array_push($all, $row);\n }\n return $all;\n }", "public function get_unread_messages($user)\n {\n $this->db->from('privmsgs_to')\n ->where('pmto_recipient_user', $user)\n ->where('pmto_unread', 'y');\n $query = $this->db->get();\n\n if ($query->num_rows() > 0) {\n $unread = array();\n\n foreach ($query->result() as $row) {\n $unread[] = $row->pmto_message;\n }\n\n return $unread;\n }\n\n return false;\n }", "function displayInbox($params) {\r\n\t\treturn $this->dsInbox($params)->items(E('messages'), 'message');\r\n\t}", "public function messages_by_user_get() {\n\t\t$uid = $this->input->get('uid');\n\t\t$skip = $this->input->get('skip');\n\t\t$limit = $this->input->get('limit');\n\n\t\t$messages = $this->Messages_model->getMessagesByUserID($uid, $skip, $limit);\n\t\t\n\t\tforeach($messages as $key=>$value) {\n\t\t\t$id = $messages[$key]['_id']->{'$id'};\n\t\t\t$messages[$key]['_id'] = $id;\n\t\t}\n\t\t\n\t\t$this->response($messages);\n\t}", "public static function getUserMessages($task_id, $user_id): array\n {\n return self::find()->where(['task_id' => $task_id])\n ->andWhere(['recipient_id' => $user_id])\n ->andWhere(['unread' => 1])->asArray()->all();\n }", "public function unreadMessagesWithUser(User $user)\n {\n return $this->receivedMessages()\n ->where('sender_id', $user->id)\n ->whereNull('read_at');\n }", "protected function getUnreadInbox(): array\n {\n return $this->unreadInbox;\n }", "public function getMessages ()\n\t{\n\t\t$messages = array();\t//Prevent foreach loop error\n\t\t$Statement = $this->Database->prepare(\"SELECT messages.*, users.first_name, users.last_name, users.thumbnail FROM messages INNER JOIN users ON messages.sender_id = users.id WHERE reciever = ? ORDER BY id DESC LIMIT 30\");\n\t\t$Statement->execute(array($this->id));\n\t\t$messages = $Statement->fetchAll();\n\t\t\n\t\treturn $messages;\n\t}", "public function selectMessagesForUserID($userid, $toUser=true, $unreadOnly=false, $archivedOnly=false) {\n $searchUser = 'to_user';\n if (!$toUser) {\n $searchUser = 'from_user';\n }\n $readFilter = '';\n if ($unreadOnly) {\n $readFilter = 'and not read';\n }\n // select only deleted messages if $archivedOnly is true\n $archiveFilter= ($archivedOnly ? \"deleted \" : \"not deleted\");\n\n $result = $this->sdb->query(\n 'select m.*,to_char(m.time_sent, \\'YYYY-MM-DD\"T\"HH24:MI:SS\\') as sent_date from messages m where '\n .$archiveFilter.' and '.$searchUser.' = $1 '.$readFilter.' order by m.time_sent desc',\n array($userid));\n\n $all = array();\n while ($row = $this->sdb->fetchrow($result)) {\n array_push($all, $row);\n }\n return $all;\n }", "function loadMessages($thread_id)\n\t\t{\n\t\t\t$query=sqlite_query($this->connection, \"SELECT user_id, message, date FROM message WHERE thread_id='$thread_id' ORDER BY message_id ASC\");\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}\n\t\t\treturn $row;\n\t\t}", "static function getMessages($application=\"all\", $userName=\"\"){\n $usr = (!$userName)? (self::getUser()) : ($userName);\n $result = Array();\n return $result;\n }", "public function showAllMessagesOfCurrentUser()\n {\n $token = substr($this->request->getHeaderLine('Authorization'),7);\n $pageNumber = (int)$this->request->getHeaderLine('Page-Number');\n $pageSize = (int)$this->request->getHeaderLine('Page-Size');\n \n if(\n $token == null or \n $pageNumber == null or \n $pageNumber < 1 or\n $pageSize == null or\n $pageSize < 1\n )\n {\n $this->logger->warning(\n \"Missing or bad data!\",\n [\n \"token\" => $token,\n \"pageNumber\" => $pageNumber,\n \"pageSize\" => $pageSize\n ]\n );\n return $this->badRequest(\"Missing or bad data!\");\n }\n\n $userHelper = new HelperUser();\n $currentUser = $userHelper -> authenticateWithToken($token);\n\n if ($currentUser == null)\n {\n $this->logger->warning(\n \"Unable to authorize user!\",\n [\n \"token\" => $token\n ]\n );\n return $this->unauthorized();\n }\n\n $messageRepository = new RepositoryMessage();\n $messages = $messageRepository->fetchMessagesOfUser(\n $currentUser,\n $pageNumber,\n $pageSize\n );\n\n return $this->responseFactory->generateResponse(\n $this->response,\n 200,\n $this->jsonFactory->generateMessagesJson($messages),\n true\n );\n }", "public function getAll()\n\t{\n\t\t$msgs = Message::findByUser($this->getUser());\n\t\t$this->updateQueryTime();\n\t\treturn $msgs;\n\t}", "function getUnreadMessages($nid,$uid)\n\t{\n\t\t$db=JFactory::getDBO();\n\t\t//get all unread messages against current node for this user\n\t\t$query =\"SELECT m.msg_id AS mid,m.from AS fid, m.msg, m.time AS ts\n\t\tFROM #__jbolo_chat_msgs AS m\n\t\tLEFT JOIN #__jbolo_chat_msgs_xref AS mx ON mx.msg_id=m.msg_id\n\t\tWHERE m.to_node_id=\".$nid.\"\n\t\tAND mx.to_user_id =\".$uid.\"\n\t\tAND mx.read = 0\n\t\tORDER BY m.msg_id \";\n\t\t$db->setQuery($query);\n\t\t//$messages = $db->loadAssocList();\n\t\t$messages=$db->loadObjectList();\n\t\t//print_r($messages);\n\t\treturn $messages;\n\t}", "public function getUserMessage($user_id,$count)\n {\n $usermessages = $this->db->fetchAll(\"SELECT DISTINCT i.message,i.mg_id,u.mobile as wumobile,i.read_status,i.datetime,m.mobile as aumobile FROM sanchr5m_messaging_db.message m,inbox i,senderID s,user u WHERE m.subscriber_id='\".$user_id.\"' AND m.mg_id=i.mg_id AND m.sender_id=s.text AND s.user_id=u.id ORDER BY i.id DESC LIMIT $count\", Phalcon\\Db::FETCH_ASSOC);\n // print_r($messages);\n return $usermessages;\n \n }" ]
[ "0.707488", "0.7053745", "0.6857768", "0.6653979", "0.6648986", "0.6538729", "0.6520564", "0.64238125", "0.6419589", "0.63453835", "0.6323402", "0.63189006", "0.6292558", "0.6289247", "0.62594396", "0.62202203", "0.62114084", "0.61960834", "0.61253774", "0.6089389", "0.60783815", "0.60590047", "0.6040387", "0.6015803", "0.59915686", "0.59846425", "0.59623826", "0.5953534", "0.594477", "0.59322697" ]
0.70797
0
/ remove_book: removes a book by it's id
function remove_book($db, $bookid) { $sql = "UPDATE textbooks SET removed = 1 where id = :id"; $st = $db->prepare($sql); $st->execute(array(':id'=>$bookid)); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteFromBook(Book $book);", "public function deleteBook($id)\n {\n MyLogger::info(\"Entering OwnedBookBusinessService.deleteBook\");\n //creates a connection\n $db = new Connection();\n $conn = $db->open();\n \n //calls the data service\n $service = new OwnedBookDataService($conn);\n \n //sends the model to the delete function in the data service\n $success = $service->removeBookFromList($id);\n \n //closes the connection\n $conn = null;\n \n //if it is successful return true\n if ($success == 1) { return true; }\n \n //else return false\n else { return false; }\n MyLogger::info(\"Exiting OwnedBookBusinessService.deleteBook\");\n }", "public function deleteBook ($session, $id) {\n\n // make a variable for books\n $books = $session->get('books');\n // remove book from books\n unset($books[$id]);\n // not necessarily sure why I need to do this\n $session->put('books', $books);\n\n }", "public function deletebook($book_id)\r\n {\r\n $sql = \"DELETE FROM book WHERE book_id = :book_id\";\r\n $query = $this->db->prepare($sql);\r\n $parameters = array(':book_id' => $book_id);\r\n // useful for debugging: you can see the SQL behind above construction by using:\r\n // echo '[ PDO DEBUG ]: ' . Helper::debugPDO($sql, $parameters); exit();\r\n $query->execute($parameters);\r\n }", "public function deleteBook($id) {\n\n $stmt = $this->db-> prepare(\"DELETE FROM book WHERE id = :id\");\n $stmt-> bindValue(':id', $id);\n\n $stmt-> execute();\n }", "public function deleteBook()\n {\n $id = $_POST['id'];\n $time = DELETE_AFTER;\n if (USE_ONE_TABLE) {\n $sql = \"UPDATE `books_authors` SET `deleted` = DATE_ADD(NOW(), interval $time HOUR) WHERE `id` = ?\";\n } else {\n $sql = \"UPDATE `books` SET `deleted` = DATE_ADD(NOW(), interval $time HOUR) WHERE `id` = ?\";\n }\n $this->findBySql($sql, [$id]);\n\n }", "function delete_booksinn($id)\n {\n return $this->db->delete('booksinn',array('id'=>$id));\n }", "public function delete_book($id_book) {\n\t\t$data = ['deleted' => 1];\n\t\tBooksCModel::update_book($id_book, $data);\n\t\treturn redirect()->back()->with('success','Xóa truyện thành công');\n\t}", "public function deleteBook($bookID)\n {\n \tinclude(\"../Database/db_connect.php\");\n\n\t\t$result = mysqli_query($dbhandle, \"SELECT * FROM books WHERE Groupnumber = '31' AND Bookid='$bookID'\") or die (mysql_error());\n\n \t//if this book doesn't exist, error out\n \tif(mysqli_num_rows($result) == 0)\n \t{\n \t\t$_SESSION[\"error\"] = \"cannot delete book, book doesn't exist\";\n \t}\n\n \t//if it exists get a list of copyID's\n \telse\n \t{\n \t\t$result2 = mysqli_query($dbhandle, \"SELECT * from bookscopy WHERE Groupnumber = '31' AND Bookid = '$bookID'\") or die (mysql_error());\n \t\t$copyIDList = array();\n\n \t\twhile($row = mysqli_fetch_array($result2))\n \t\t{\n \t\t\t$result3 = mysqli_query($dbhandle, \"SELECT * FROM shelves WHERE Groupnumber = '31' AND Copyid = '$row[Copyid]'\") or die (mysql_error());\n \t\t\t$shelf_data = mysqli_fetch_array($result3);\n \t\t\t$copyIDList[$shelf_data['Copyid']] = $shelf_data['Shelfid'];\n \t\t}\n\n \t\t//remove book from database\n //remove copy id's from shelf\n foreach($copyIDList as $copyIDKey => $shelfIDValue)\n {\n for($i = 0; $i < 10; $i++)\n {\n if($this->shelf[$i]->index == $shelfIDValue)\n {\n $this->shelf[$i]->deleteBook($copyIDKey);\n mysqli_query($dbhandle, \"DELETE FROM loanHistory WHERE Groupnumber = '31' AND Copyid = '$copyIDKey'\");\n }\n }\n }\n\n mysqli_query($dbhandle, \"DELETE FROM bookscopy WHERE Groupnumber = '31' AND Bookid = '$bookID'\") or die (mysql_error());\n mysqli_query($dbhandle, \"DELETE FROM books WHERE Groupnumber = '31' AND Bookid = '$bookID'\") or die (mysql_error());\n \t}\n\n \tinclude(\"../Database/db_close.php\");\n }", "public function deletebookById($id)\n {\n return $this->bookDao->deletebookById($id);\n }", "public function deleteBook($id) {\n\n $book = Libro::findOrFail($id);\n $book->delete();\n\n return(\"Libro eliminado con exito... Será redirigido al listado de libros en 5 segundos.\");\n }", "public function delete($id){\n $library = Library::find(Auth::user()->library->id);\n $library->books()->detach($id);\n return redirect('/');\n }", "public function remove($id);", "public function remove($id);", "public function removeBook($isbn) {\n\t\t$userBook = new MUserBook();\n\t\t$userBook->userId = $this->id;\n\t\t$userBook->isbn = $isbn;\n\t\treturn $userBook->delete();\n\t}", "function RemoveSingleBook()\n {\n $id_libro = $_POST[\"id_libro\"];\n $cart = new Carrello;\n $cart->RemoveSingleBook($id_libro);\n $book = new Libri;\n $libro = $book->GetBook($id_libro);\n return $libro[\"titolo\"].\"$$$\".$libro[\"autore\"].\"$$$\".$libro[\"prezzo\"].\"$$$\".$libro[\"path_copertina\"];\n }", "public function remove($id) {\r\n $this->db->where('id', $id);\r\n\t\t$this->db->where('school_id', $this->school_id);\r\n $this->db->delete('book_issues');\r\n }", "public function deletebook($id)\n {\n $id = Crypt::decryptString($id);\n DB::table('books')\n ->where('id', $id)\n ->delete();\n\n return redirect()\n ->route('books');\n }", "function delete_book($piecemakerId) \n\t{\n global $wpdb;\n @unlink($this->plugin_path.$this->books_dir.\"/\".$piecemakerId.\".xml\");\n\n $sql = \"delete from `\".$this->table_name.\"` where `id` = '\".$piecemakerId.\"'\";\n $wpdb->query($sql);\n\n unset($_POST['do']);\n $this->manage_books();\n\t}", "public function destroy($id)\n {\n //\n \n $book = Library::find($id);\n //print_r($book);\n $book->delete();\n return Redirect::to('library');\n }", "function delete_book( $id ) {\r\n\treturn wp_delete_post($id);\r\n}", "public function deleteBook()\n\t{\n\t\tif (cookie('staffAccount') != '') {\n\t\t\t$bookid = $_POST['book_id'];\n\t\t\t$reason = $_POST['reason'];\n\t\t\t$staff_id = cookie('staffAccount');\n\t\t\t$remove_time = date('Y-m-d');\n\t\t\t$book_id = intval($bookid);\n\t\t\t$book = D('Remove');\n\n\t\t\t$sql1 = \"select * from lib_book_unique where book_id = {$book_id};\";\n\t\t\t$ret1 = $book->query($sql1);\n\t\t\tif ($ret1) {\n\t\t\t\t$sql2 = \"select * from lib_remove where book_id = {$book_id};\";\n\t\t\t\t$ret2 = $book->query($sql2);\n\t\t\t\tif ($ret2) {\n\t\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t\t'msg' => 'It has been deleted!'\n\t\t\t\t\t));\n\t\t\t\t\techo $json;\n\t\t\t\t} else {\n\t\t\t\t\t$sql3 = \"select * from lib_borrow where book_id = {$book_id};\";\n\t\t\t\t\t$ret3 = $book->query($sql3);\n\t\t\t\t\tif ($ret3) {\n\t\t\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t\t\t'msg' => 'It has been borrowed!'\n\t\t\t\t\t\t));\n\t\t\t\t\t\techo $json;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$sql = \"insert into lib_remove \n\t\t\t\t\t\t\t\tvalues('{$book_id}','{$reason}','{$remove_time}','{$staff_id}');\";\n\t\t\t\t\t\t$return = $book->execute($sql);\n\t\t\t\t\t\tif ($return) {\n\t\t\t\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t\t\t\t'code' => 'success',\n\t\t\t\t\t\t\t\t'msg' => 'Delete successfully!'\n\t\t\t\t\t\t\t));\n\t\t\t\t\t\t\techo $json;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t\t\t\t'msg' => 'SQL Error!'\n\t\t\t\t\t\t\t));\n\t\t\t\t\t\t\techo $json;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$json = json_encode(array(\n\t\t\t\t\t'code' => 'fail',\n\t\t\t\t\t'msg' => 'This book is not exist!'\n\t\t\t\t));\n\t\t\t\techo $json;\n\t\t\t}\n\n\n\n\t\t} else {\n\t\t\t$json = json_encode(array(\n\t\t\t\t'code' => 'fail',\n\t\t\t\t'msg' => 'Please Login!'\n\t\t\t));\n\t\t\techo $json;\n\t\t}\n\t}", "public function destroy(book $book)\n {\n //\n }", "abstract public function remove($id);", "public function deletebook($id)\n {\n Book::where('Id',$id)->delete();\n return response(array(\n 'success' => true,\n 'message' => 'Delete book successfully',\n\n ),200);\n }", "function removeFromCart($bookId){\n\t\tif (array_key_exists($bookId, $this->articulos)){\n\t\t\tif ($this->articulos[$bookId]['cantidad']>1) $this->articulos[$bookId]['cantidad']--;\n\t\t\telse unset($this->articulos[$bookId]);\n\t\t}\n\t}", "public function delete($id){\n\t\t$this->book_model->delBook($id);\n\t\t// arahkan ke method 'books' di kontroller 'dashboard'\n\t\tredirect('dashboard/books');\n\t}", "public function getDoDelete($id) {\n $book = \\P4\\Book::find($id);\n\n if(is_null($book)) {\n \\Session::flash('message','Book not found.');\n return redirect('\\books');\n }\n\n # First remove any tags associated with this book\n if($book->tags()) {\n $book->tags()->detach();\n }\n\n # Then delete the book\n $book->delete();\n\n # Done\n \\Session::flash('message',$book->title.' was deleted.');\n return redirect('/books');\n\n }", "public function destroy($id) {\n $book = Book::find($id);\n $book->delete();\n\n Session::flash('deleteBook', \"$book->name has been deleted successfully.\");\n }", "public function destroy($id)\n {\n $book = Book::find($id);\n\n if($book->cover_image != 'no_book_image.jpg')\n {\n Storage::delete('public/cover_images/'.$book->cover_image);\n }\n $book->delete();\n\n return redirect()->route('booklist')->with('success','Book Removed from Library.');\n }" ]
[ "0.7321427", "0.7192881", "0.7186981", "0.7172877", "0.7118792", "0.70581", "0.69076556", "0.6901053", "0.69007015", "0.68185097", "0.68055737", "0.67794275", "0.67530435", "0.67530435", "0.6749105", "0.67399174", "0.6685761", "0.6677873", "0.6672676", "0.6666551", "0.6657567", "0.6636819", "0.6595744", "0.65731615", "0.65502584", "0.6546543", "0.65011513", "0.6435132", "0.6416766", "0.6400045" ]
0.78322184
0
/ modify_user: takes a user id, and updates it with a new email, password and display name.
function modify_user($db, $user_id, $new_email, $new_password, $new_display_name) { $new_password = md5($new_password); $sql = "UPDATE users SET email=:new_email, password=:new_password, display_name=:new_display_name WHERE id = :user_id"; $st = $db->prepare($sql); $st->execute(array(':new_email'=>$new_email, ':new_password'=>$new_password, ':new_display_name'=>$new_display_name, ':user_id' => $user_id)); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function modify_user($user);", "function admin_modify_user($id)\n{\n global $app;\n\n // parameter checking\n if (!is_numeric($id)) {\n $app->getLog()->warn('admin_modify_user: invalid user id ' . $id);\n $app->halt(400, \"Bad parameter\");\n }\n\n $user_data = $app->request()->put();\n $app->getLog()->debug('admin_modify_user: ' . var_export($user_data, true));\n $user = $app->bbs->changeUser(\n $id,\n $user_data['password'],\n $user_data['languages'],\n $user_data['tags'],\n $user_data['role']\n );\n $app->getLog()->debug('admin_modify_user: ' . var_export($user, true));\n $resp = $app->response();\n if (isset($user) && !is_null($user)) {\n $resp->status(200);\n $msg = getMessageString('admin_modified');\n $answer = json_encode(['user' => $user->getProperties(), 'msg' => $msg]);\n $resp->header('Content-type', 'application/json');\n } else {\n $resp->status(500);\n $resp->header('Content-type', 'text/plain');\n $answer = getMessageString('admin_modify_error');\n }\n $resp->header('Content-Length', strlen($answer));\n $resp->body($answer);\n}", "public function modify_user($user) {\r\n $this->conn->connect();\r\n $this->conn->execute_query(\r\n \"UPDATE Users \r\n SET\r\n UserType=?,\r\n FirstName=?,\r\n LastName=?,\r\n HomePhone=?,\r\n MobilePhone=?,\r\n Address1=?, \r\n Address2=?,\r\n City=?,\r\n State=?,\r\n ZipCode=?\r\n WHERE UserId=?\",\"dsssssssssd\",\r\n $user->get_user_type(),\r\n $user->get_first_name(),\r\n $user->get_last_name(),\r\n $user->get_home_phone(),\r\n $user->get_mobile_phone(),\r\n $user->get_address_1(),\r\n $user->get_address_2(),\r\n $user->get_city(),\r\n $user->get_state(),\r\n $user->get_zip(),\r\n $user->get_user_id()\r\n );\r\n }", "public function edit($user_id)\n\t{\n\t\t$stmt = self::$_connection->prepare(\"UPDATE user_profile SET first_name = :first_name, last_name = :last_name, email=:email, country = :country, city = :city, street_address = :street_address, postal_code = :postal_code WHERE user_id = :user_id\");\n\t\t$stmt->execute(['first_name'=>$this->first_name, 'last_name'=>$this->last_name, 'email'=>$this->email, 'country'=>$this->country, 'city'=>$this->city, 'street_address'=>$this->street_address, 'postal_code'=>$this->postal_code, 'user_id'=>$user_id]);\n\t}", "function updateUser(){\n\t\t\tif($this->rest->getRequestMethod() != \"PUT\"){\n\t\t\t\t$this->rest->response('',406);\n\t\t\t\texit;\n\t\t\t}\n\t\t\t//Validate the user\n\t\t\t$validUser = $this->validateUser(\"admin\", \"basic\");\n\t\t\tif ($validUser) {\n\t\t\t\tif (isset($_POST['user_name']) && isset($_POST['password']) && isset($_POST['_id'])){\n\t\t\t\t\t$user_id = $_POST['_id'];\n\t\t\t\t\t$array['user_name'] = $_POST['user_name'];\n\t\t\t\t\t$array['password'] = $_POST['password'];\n\t\t\t\t\t$result = $this->model->setUser($array, \"_id='\".$user_id.\"'\");\n\t\t\t\t\tif($result) {\n\t\t\t\t\t\t$response_array['status']='success';\n\t\t\t\t\t\t$response_array['message']='One record updated.';\n\t\t\t\t\t\t$update = $this->model->getUser('*',\"_id = \".\"'\".$user_id.\"'\");\n\t\t\t\t\t\t$response_array['data']=$update;\n\t\t\t\t\t\t$this->rest->response($response_array, 200);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$response_array['status']='fail';\n\t\t\t\t\t\t$response_array['message']='no record updated';\n\t\t\t\t\t\t$response_array['data']='';\n\t\t\t\t\t\t$this->rest->response($response_array, 304);\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$this->rest->response('No parameters given',204);\t// If no records \"No Content\" status\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->rest->response('Unauthorized Access ',401);\t\n\t\t\t}\n\t\t\t\n\n\t\t}", "public function updateUser( UserDataInf $user )\n {\n \n $userName = $user->getName();\n \n $userId = $this->getUserId( $userName );\n $passwd = Password::passwordHash( $user->getPasswd() );\n \n $sqlUser = <<<SQL\nUPDATE wbfsys_role_user\nSET\n name = '{$userName}', \n inactive = FALSE, \n non_cert_login = TRUE,\n profile = '{$user->getProfile()}',\n level = '{$user->getLevel()}',\n password = '{$passwd}'\nWHERE rowid = {$userId}\n;\nSQL;\n \n $this->db->update( $sqlUser );\n \n $personId = $this->db->select( 'SELECT id_person from wbfsys_role_user where rowid = '.$userId );\n \n \n $sqlPerson = <<<SQL\nUPDATE core_person\nSET\nfirstname = '{$user->getFirstname()}', \nlastname = '{$user->getLastname()}'\nWHERE rowid = {$personId};\nSQL;\n\n $this->db->update( $sqlPerson );\n \n }", "function editUser($id, $fname, $username, $password, $email){\n $pdo = Database::getInstance()->getConnection();\n\n //TODO: Run the proper SQL query to update tbl_user with proper values\n $update_user_query = 'UPDATE tbl_user SET user_fname = :fname, user_name = :username,';\n $update_user_query .= ' user_pass=:password, user_email =:email WHERE user_id = :id';\n $update_user_set = $pdo->prepare($update_user_query);\n $update_user_result = $update_user_set->execute(\n array(\n ':fname'=>$fname,\n ':username'=>$username,\n ':password'=>$password,\n ':email'=>$email,\n ':id'=>$id\n )\n );\n\n // echo $update_user_set->debugDumpParams();\n // exit;\n\n //TODO: if everything goes well, redirect user to index.php\n // Otherwise, return some error message...\n if($update_user_result){\n redirect_to('index.php');\n }else{\n return 'Guess you got canned...';\n }\n}", "function editUser($id, $fname, $username, $password, $email) {\n\t\tinclude('connect.php');\n// Update user with edit query\n\t\t$updatestring = \"UPDATE tbl_user SET user_fname='{$fname}', user_name='{$username}', user_pass='{$password}', user_email='{$email}' WHERE user_id={$id}\";\n\t\t$updatequery = mysqli_query($link, $updatestring);\n\n\t\tif($updatequery) {\n\t\t\tredirect_to(\"admin_index.php\");\n\t\t}else{\n\t\t\t$message = \"Something went wrong; you are not allowed to change the information.\";\n\t\t\treturn $message;\n\t\t}\n mysqli_close($link);\n\t}", "public function updateUser($userId=-1,$firstName=null, $lastName=null, $userName=null, $password=null, $emailAddress=null,$studentId=null, $major=null, $address=null);", "public function editUser(UserEditForm $form, User $user);", "public function editUserLogin($id, $user, $name, $email, $password, $admin)\n {\n $sql = \"UPDATE login SET username=?, password=?, name=?, email=?, admin=? WHERE id = ?;\";\n $this->db->execute($sql, [$user, $password, $name, $email, $admin, $id]);\n }", "public function modifyAction($userId = 0, ParamFetcher $paramFetcher)\n {\n $userInfo = $this->get('UserServices')->getUserInfoById($userId);\n\n if (empty($userInfo)) throw new HttpException(400, $this->translator->trans('Invalid user credentials. Please try again.'));\n\n $params = array();\n $params['id'] = $userId;\n\n //we need to match what's in the database\n $fields = array(\n 'yourEmail' => 'email',\n 'yourUserName' => 'userName',\n 'fname' => 'fname',\n 'lname' => 'lname',\n 'websiteUrl' => 'websiteUrl',\n 'smallDescription' => 'smallDescription',\n 'yourBday' => 'birthdate',\n 'accountId' => 'accountId',\n 'gender' => 'gender',\n 'cmsUserGroupId' => 'userRole',\n );\n\n $post = $paramFetcher->all();\n\n foreach ($fields as $key => $val) {\n if (isset($post[$val]) && $post[$val]) $params[$key] = $post[$val];\n }\n\n if (isset($params['yourBday']) && $params['yourBday']) {\n $params['yourBday'] = date(\"Y-m-d\", strtotime($params['yourBday']));\n }\n\n if (isset($params['yourEmail']) && $params['yourEmail']) {\n if ($this->get('UserServices')->checkDuplicateUserEmail($userId, $params['yourEmail'])) {\n throw new HttpException(422, $this->translator->trans('This email address belongs to an existing Tourist Tuber.'));\n }\n }\n\n if (isset($params['yourUserName']) && $params['yourUserName']) {\n if ($this->get('UserServices')->checkDuplicateUserName($userId, $params['yourUserName'])) {\n $suggestedNewUserNames = $this->get('UserServices')->suggestUserNameNew($params['yourUserName']);\n throw new HttpException(422, $this->translator->trans('Your username is already taken. try:') . ' ' . implode(' or ', $suggestedNewUserNames));\n }\n }\n\n $success = $this->get('UserServices')->modifyUser($params);\n\n if (is_array($success) && isset($success['error']) && !empty($success['error'])) {\n throw new HttpException(422, $success['error']);\n }\n\n $result = array();\n $result['status'] = \"success\";\n $result['message'] = $this->translator->trans('User information has been succesfully updated.');\n\n $response = new Response(json_encode($result));\n $response->setStatusCode(200);\n return $response;\n }", "function edit_user($user, $id)\n{\n global $db;\n\n $errors = validate_edit_user($user);\n\n if (!empty($errors)) {\n return $errors;\n }\n\n $query = \"UPDATE User SET user_name = ?, user_first = ?, user_last = ?,\";\n $query .= \"user_email = ? WHERE user_id = ?\";\n\n $stmt = $db->prepare($query);\n $stmt->bind_param(\n \"ssssi\",\n $user['user_name'],\n $user['user_first'],\n $user['user_last'],\n $user['user_email'],\n $id\n );\n $result = $stmt->execute();\n\n if ($result) {\n return true;\n } else {\n return false;\n }\n}", "public function testUpdateUser()\n {\n }", "public function edit($user_id) {\n if ($_POST){\n #izmena vrednosti\n #redirekcija na listu\n \n $username = filter_input(INPUT_POST, 'username');\n $lastname = filter_input(INPUT_POST, 'lastname');\n $email = filter_input(INPUT_POST, 'email');\n \n if (!preg_match('/^[a-z0-9]{4,}$/', $username) or !preg_match('[A-z 0-9\\-]+', $fullname) or $email == '') {\n $this->setData('message', 'Izmene nisu tačno unete.');\n } else {\n $res = HomeModel::editById($user_id, $username, $lastname, $email);\n if ($res){\n Misc::redirect('homepage');\n } else {\n $this->setData('message', 'Došlo je do greške prilikom izmene.');\n }\n }\n \n }\n \n $user = HomeModel::getById($user_id);\n $this->setData('korisnik', $user);\n }", "public function updateUser($userId, $userName, $userLastname, $userPseudo, $userMail, $userStatut) {\n $db = $this->dbConnect();\n $req = $db->prepare('UPDATE p5_users SET USER_NAME= ?,USER_LASTNAME=?,USER_PSEUDO=?,USER_MAIL=?,ROOT=? WHERE USER_ID= ?');\n $req->execute(array($userName, $userLastname, $userPseudo, $userMail, $userStatut, $userId));\n $req->closeCursor();\n }", "public function update()\n { if (is_null($this->id))\n trigger_error(\"User::update(): Attempt to update a User object that does not have its ID property set.\", E_USER_ERROR);\n \n // Update the User\n $conn = new PDO(DB_DSN, DB_USER, DB_PASS);\n $sql = \"UPDATE users SET user_name=:user_name, user_password_hash=:user_password_hash, user_email=:user_email, orcid=:orcid, orcid_code=:orcid_code, orcid_access_token=:orcid_access_token WHERE user_id = :id\";\n $st = $conn->prepare($sql);\n $st->bindValue(\":user_name\", $this->userName, PDO::PARAM_STR);\n $st->bindValue(\":user_password_hash\", $this->userPasswordHash, PDO::PARAM_STR);\n\t$st->bindValue(\":user_email\", $this->userEmail, PDO::PARAM_STR);\n $st->bindValue(\":orcid\", $this->orcid, PDO::PARAM_STR);\n $st->bindValue(\":orcid_code\", $this->orcidCode, PDO::PARAM_STR);\n $st->bindValue(\":orcid_access_token\", $this->orcidAccessToken, PDO::PARAM_STR);\n $st->bindValue(\":id\", $this->id, PDO::PARAM_INT);\n $st->execute();\n $conn = null;\n }", "function updateUser($id) {\n $data = array(\n 'email' => $this->input->post('email'),\n 'firstName' => $this->input->post('firstName'),\n 'midName' => $this->input->post('midName'),\n 'lastName' => $this->input->post('lastName'),\n 'roleID' => $this->input->post('role'),\n 'password' => md5($this->input->post('password').SALT),\n );\n $this->db->where('userID', $id);\n $this->db->update('user', $data);\n }", "public function updateUser(UserInterface $user);", "public function user_info_edit($id) {\n if ($this->request->is('post')) {\n $data = $this->request->data;\n $id = $data['id'];\n $update = $this->User->updateUser($id, $data);\n\n $this->redirect(array(\n 'action' => 'user_dashboard?msg=succesmsg',\n ));\n }\n }", "public function editUser($params) {\n $token = $this->require_authentication();\n\n try {\n $baseType = USER::TYPE_COMMENTER;\n $user = $token->getUser();\n\n $user->setUsername(strtolower($_POST['username2']));\n $user->setPassword($_POST['password2']);\n $user->setEmail($_POST['email2']);\n $user->setType($baseType);\n $user->setFirstname($_POST['firstname2']);\n $user->setLastname($_POST['lastname2']);\n $user->setPrivacy($_POST['privacy2']);\n\n $res = $user->commit($this->getDBConn());\n\n error_log(\"Edited user \". $user->getUserId());\n if ($res) {\n // display success message and redirect to new user's page\n $this->addFlashMessage('Edited user: ' . $user->getUsername(), self::FLASH_LEVEL_SUCCESS);\n $this->redirect(\"/users/\");\n } else {\n $this->addFlashMessage('Unknown error adding user. Please try again: ', self::FLASH_LEVEL_SERVER_ERR);\n }\n } catch (\\PDOException $dbErr) {\n $this->addFlashMessage('Database error on adding user:<br>'.$dbErr->getMessage(), self::FLASH_LEVEL_SERVER_ERR);\n }\n\n }", "public function actionUpdateUser($id)\n {\n $model = $this->findModelUser($id);\n\n if ($model->load(Yii::$app->request->post()) && $model->validate()) {\n\n $model->setPassword($model->password);\n $model->generateAuthKey();\n $model->generateEmailConfirmToken();\n if ($model->save()) {\n // нужно добавить следующие три строки:\n // $auth = Yii::$app->authManager;\n // $authorRole = $auth->getRole('superadmin');\n // $auth->assign($authorRole, $user->getId());\n return $this->redirect(['view-user', 'id' => $model->id]);\n }else{\n print_arr($model->errors);\n die('A');\n }\n } else {\n return $this->render('user/update', [\n 'model' => $model,\n ]);\n }\n }", "function wp_editUser( $args ) {\n\n global $wp_xmlrpc_server, $wp_roles;\n $wp_xmlrpc_server->escape( $args );\n\n $blog_ID = (int) $args[0];\n $user_ID = (int) $args[1];\n $username = $args[2];\n $password = $args[3];\n $content_struct = $args[4];\n\n if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) )\n return $wp_xmlrpc_server->error;\n\n $user_info = get_userdata( $user_ID );\n\n if( ! $user_info )\n return new IXR_Error(404, __('Invalid user ID'));\n\n if( ! ( $user_ID == $user->ID || current_user_can( 'edit_users' ) ) )\n return new IXR_Error(401, __('Sorry, you cannot edit this user.'));\n\n // holds data of the user\n $user_data = array();\n $user_data['ID'] = $user_ID;\n\n if ( isset( $content_struct['user_login'] ) )\n return new IXR_Error(401, __('Username cannot be changed'));\n\n if ( isset( $content_struct['user_email'] ) ) {\n\n if( ! is_email( $content_struct['user_email'] ) )\n return new IXR_Error( 403, __( 'Email id is not valid' ) );\n // check whether it is already registered\n if( email_exists( $content_struct['user_email'] ) )\n return new IXR_Error( 403, __( 'This email address is already registered' ) );\n $user_data['user_email'] = $content_struct['user_email'];\n \n }\n\n if( isset ( $content_struct['role'] ) ) {\n\n if ( ! current_user_can( 'edit_users' ) )\n return new IXR_Error( 401, __( 'You are not allowed to change roles for this user' ) );\n\n if( ! isset ( $wp_roles ) )\n $wp_roles = new WP_Roles ();\n if( !array_key_exists( $content_struct['role'], $wp_roles->get_names() ) )\n return new IXR_Error( 403, __( 'The role specified is not valid' ) );\n $user_data['role'] = $content_struct['role'];\n \n }\n\n // only set the user details if it was given\n if ( isset( $content_struct['first_name'] ) )\n $user_data['first_name'] = $content_struct['first_name'];\n\n if ( isset( $content_struct['last_name'] ) )\n $user_data['last_name'] = $content_struct['last_name'];\n\n if ( isset( $content_struct['user_url'] ) )\n $user_data['user_url'] = $content_struct['user_url'];\n\n if ( isset( $content_struct['nickname'] ) )\n $user_data['nickname'] = $content_struct['nickname'];\n\n if ( isset( $content_struct['user_nicename'] ) )\n $user_data['user_nicename'] = $content_struct['user_nicename'];\n\n if ( isset( $content_struct['description'] ) )\n $user_data['description'] = $content_struct['description'];\n\n if( isset ( $content_struct['usercontacts'] ) ) {\n\n $user_contacts = _wp_get_user_contactmethods( $user_data );\n foreach( $content_struct['usercontacts'] as $key => $value ) {\n\n if( ! array_key_exists( $key, $user_contacts ) )\n return new IXR_Error( 401, __( 'One of the contact method specified is not valid' ) );\n $user_data[ $key ] = $value;\n\n }\n\n }\n\n if( isset ( $content_struct['user_pass'] ) )\n $user_data['user_pass'] = $content_struct['user_pass'];\n\n $result = wp_update_user( $user_data );\n\n if ( is_wp_error( $result ) )\n return new IXR_Error( 500, $result->get_error_message() );\n\n if ( ! $result )\n return new IXR_Error( 500, __( 'Sorry, the user cannot be updated. Something wrong happened.' ) );\n\n return $result;\n \n}", "function user_edit($user_info)\n {\n }", "public function editUser($id, $name, $email, $password, $role): void\n {\n $user = $this->repoManager->getRepository(User::class)->find($id);\n $user->setName($name);\n $user->setEmail($email);\n if ($password !== \"\") {\n $user->setPassword($password);\n }\n $user->setRole($role);\n //TODO add validations\n $user->save();\n\n }", "static function update_user ($id, $user) {\n $query = \"UPDATE edit SET \";\n $query .= \"user=\\\"{$user}\\\" \";\n $query .= \"WHERE id={$id};\";\n\n if (!$GLOBALS['C']->query($query)) {\n print_query_error();\n return false;\n } else {\n return true;\n }\n }", "function updateUser($id, $FirstName, $LastName, $password, $email)\r\n {\r\n $sql = \"UPDATE users SET ID_user='\" . $id . \"', FirstName='\" . $FirstName . \"',\r\n LastName='\" . $LastName . \"', Password='\" . $password . \"', email='\" . $email . \"'WHERE ID_user='\" . $id . \"'\";\r\n $stmt = $this->connect()->query($sql);\r\n if (!$stmt) {\r\n echo \"Something wrong in the binding process. sql error?\";\r\n exit();\r\n } else {\r\n echo \"Update Successful\";\r\n }\r\n }", "public function editUser(){\n\n\t\t$username = filter_input(INPUT_POST, 'newusername', FILTER_SANITIZE_STRING);\n\t\t$id = $_POST[\"id\"];\n\t\ttry {\n\t\t\trequire CONTROLLER_DIR . '/dbConnecterController.php';\n\t\t\t$result = $db->query('SELECT * FROM users WHERE id=\"'.$id.'\"');\n\n\t\t\t$row = $result->fetchColumn();\n\t\t\t\tif(!$row == 0){\n\t\t\t\t\t$statement = $db->prepare(\"UPDATE users SET username=:username WHERE id=:id\");\n\t\t\t\t\t$statement->bindParam(':username', $username, PDO::PARAM_STR);\n\t\t\t\t\t$statement->bindParam(':id', $id, PDO::PARAM_INT);\n\t\t\t\t\t$statement->execute();\n\t\t\t\t\t$db = null;\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\tdie(\"No data present.\");\n\t\t\t\t}\t\n\n\t\t} catch (PDOException $e) {\n\t\t\tprint \"Error!: \" . $e->getMessage() . \"<br/>\";\n\t\t\tdie();\n\t\t}\n\t}", "public function updateUser($id, $data)\n{\n\t$this->update($data, 'iduser = '. (int)$id);\n}", "function modifyUserDetail($userId,$uname,$sex,$age,$loc,$hobby,$signature){\n DBUtils::execute('UPDATE user SET name = '.'\"'.$uname.'\",'.'sex='.'\"'.$sex.'\",'.'age='.$age.',location='.'\"'.$loc.'\",'.'hobby='.'\"'.$hobby.'\",'.'signature='.'\"'.$signature.'\" WHERE id='.$userId);\n }" ]
[ "0.82501185", "0.7879941", "0.7457829", "0.7386032", "0.7122544", "0.7100527", "0.70706975", "0.70399845", "0.7007254", "0.69977796", "0.6986978", "0.6860683", "0.68495345", "0.6808602", "0.68033755", "0.68027395", "0.6802556", "0.6785823", "0.67542595", "0.6742459", "0.6732567", "0.6705427", "0.6695127", "0.66784775", "0.6666798", "0.6651384", "0.6614497", "0.66036534", "0.65996605", "0.65972394" ]
0.8165828
1
Get all the viruses
public function getAllViruses() { return $this->selectAll('VIRUSES'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCountVirusBy() {\n\t\treturn $this->getCountBy('VIRUSES', 'name');\n\t}", "public function getCountVirus() {\n\t\treturn $this->getCount('VIRUSES', 'name');\n\t}", "public function getVirusesOnComputer($computerid)\n\t\t{\n\n\t\t\treturn self::$database->getTypeOnComputer(Settings::setting('software_virus_type'), $computerid);\n\t\t}", "function virustotalscan_info()\r\n{\r\n return array(\r\n\t\t\"name\"\t\t\t=> \"Virus Total Scanner\",\r\n\t\t\"description\"\t=> \"Scans new attachments and links by using VirusTotal.com's API.\",\r\n\t\t\"website\"\t\t=> \"http://mybb.ro\",\r\n\t\t\"author\"\t\t=> \"Surdeanu Mihai\",\r\n\t\t\"authorsite\"\t=> \"http://mybb.ro\",\r\n\t\t\"version\"\t\t=> \"1.1\",\r\n \"guid\" => \"1572096dc083bc7f00f2b4f5ae3837f7\",\r\n\t\t\"compatibility\"\t=> \"16*\"\r\n\t);\r\n}", "public function readAllVoto(){\n\n return self::read('voto','voto'); \n }", "public function getCountVirusId() {\n\t\treturn $this->getCount('VIRUSES', 'id');\n\t}", "public function getVotos() {\n return $this->votos;\n }", "public static function getAllVideo()\n {\n \treturn VedioGallary::all();\n }", "private function getVolumes()\n {\n $v = new Validator();\n $this->searchForm->author = $v->validateFromPost('author');\n $this->searchForm->title = $v->validateFromPost('title');\n $this->searchForm->year = $v->validateFromPost('year');\n \n // Wyszukanie woluminów w bazie razem z danymi dotyczącymi rezerwacji woluminów\n $this->volumes = CatalogueDAO::getVolumesExtra($this->searchForm);\n }", "public function index()\n {\n //\n return Viaje::all();\n }", "public static function getVSClasses(){return file_get_contents('queries/vsclasses.txt');}", "public function allVolumes()\n {\n return $this->volumes;\n }", "function scan()\n {\n $arlines = array();\n exec(\n $this->arfilelocation['iwpriv'] . ' '\n . escapeshellarg($this->interface) . ' get_site_survey',\n $arlines\n );\n\n return $this->parsescan($arlines);\n }", "function getAllVirtualAccounts()\n\t{\n\n\t\t$rel_url = \"virtual_accounts\";\n\n\t\t$virtualAccounts = $this->getDatafromServerUsingCurl( $rel_url );\n\n\t\treturn $virtualAccounts;\n\t}", "public function get_engines() {\n return $this->get_items_by_type(static::$ENGINES);\n }", "public function get_all_hotspot(){\n return $this->query('/ip/hotspot/getall');\n }", "public function getAll(){\n\t\t$url = WEBSERVICE. \"robots/getAll\";\n\t\t$this->HTTPRequest->setUrl($url);\n\t\t$this->HTTPRequest->setMethod(\"GET\");\n\t\t$arrayResponse = $this->HTTPRequest->sendHTTPRequest();\n\t\treturn $this->arrayToRobots($arrayResponse, false);\n\t}", "function get_votos() {\n\t\t$condicion = array(\n\t\t\t'IdUsuario' => $this->session->userdata('id_usuario'),\n\t\t);\n\t\t\n\t\t$consulta = $this->db->get_where( 'pa_capacitacion_cursos_votos', $condicion ); \n\t\t\n\t\treturn $consulta;\n\t}", "public function getAll()\n {\n $sentence = new SentenceUtil();\n $sentence->fromCommand('/ip/hotspot/getall');\n $this->talker->send($sentence);\n $rs = $this->talker->getResult();\n $i = 0;\n if ($i < $rs->size()) {\n return $rs->getResultArray();\n } else {\n return 'No IP Hotspot To Set, Please Your Add IP Hotspot';\n }\n }", "public function getLocalVoices()\n {\n $user_agent = $this->getOS();\n \n $voices = array();\n $error = false;\n $errorcode = 0;\n $errormessage = null;\n \n switch ($user_agent) {\n \n case \"Mac OS X\":\n \n try {\n // Llistat de veus\n $cmdresponse = shell_exec(\"say --voice=?\");\n\n // Partim pels espais d'abans de la definició de l'idioma de format xX_xX\n // fins al salt de línia\n $voices = preg_split( '/[\\s]+..[_-][a-zA-Z]+[\\s]+#[^\\r\\n]*(\\r\\n|\\r|\\n)/', $cmdresponse);\n // eliminem l'últim element que és buit\n array_pop($voices);\n \n } catch (Exception $ex) {\n $error = true;\n $errormessage = \"Error. Unable to access your Mac OS X voices. Try activating your system\"\n . \"voices. Otherwise, your OS X may not be compatible with the 'say' command.\";\n $errorcode = 101;\n }\n \n if (!$error && count($voices) < 1) {\n $error = true;\n $errormessage = \"Error. No installed voices found. Activate your system\"\n . \"voices or install external voices for Mac OS X (i.e. Acapela voices).\";\n $errorcode = 102;\n }\n\n break;\n \n case \"Windows\":\n\n // error de Microsoft Speech Platform\n $errorMSP = false;\n $errorMSPtmp = null;\n \n try {\n // Recollim els objectes de les llibreries Speech de Microsoft que necessitem\n $msVoice = new COM('Speech.SpVoice');\n\n $numvoices = $msVoice->GetVoices()->Count;\n\n // agafem les veus, la descripció la farem servir per buscar els idiomes\n // de cada una d'elles, idealment són les que s'haurien de llistar\n // a la interfície de l'usuari\n for ($i=0; $i<$numvoices; $i++) {\n $voices[] = $msVoice->GetVoices()->Item($i)->GetDescription;\n }\n\n // DEBUG\n // print_r($voices);\n \n } catch (Exception $ex) {\n $errorMSP = true;\n $errorMSPtmp = \"Error. Unable to access Microsoft Speech Platform.\";\n }\n \n // error de SAPI\n $errorSAPI = false;\n $errorSAPItmp = null;\n \n try {\n // Recollim els objectes de les llibreries SAPI que necessitem\n\n $msSAPIVoice = new COM('SAPI.SpVoice');\n\n $numvoicesSAPI = $msSAPIVoice->GetVoices()->Count;\n\n // agafem les veus, la descripció la farem servir per buscar els idiomes\n // de cada una d'elles, idealment són les que s'haurien de llistar\n // a la interfície de l'usuari\n\n for ($i=0; $i<$numvoicesSAPI; $i++) {\n $voices[] = $msSAPIVoice->GetVoices()->Item($i)->GetDescription;\n }\n // DEBUG\n // print_r($voices);\n \n } catch (Exception $ex) {\n $errorSAPI = true;\n $errorSAPItmp = \"Error. Unable to access SAPI voices.\";\n }\n \n if ($errorMSP && $errorSAPI) {\n $error = true;\n $errormessage = \"Error. Unable to access your Windows voices. \"\n . \"Install Microsoft Speech Platform (MSP) or SAPI voices. Otherwise, \"\n . \"your Windows may not be compatible with MSP or SAPI.\";\n $errorcode = 103;\n }\n else if (count($voices) < 1) {\n $error = true;\n $errormessage = \"Error. No installed voices found. \"\n . \"Install Microsoft Speech Platform or SAPI voices.\";\n $errorcode = 104;\n }\n\n break;\n \n default:\n $error = true;\n $errormessage = \"Error. Your OS is not compatible with the offline version of this app.\";\n $errorcode = 105;\n break;\n }\n \n $output = array(\n 0 => $voices,\n 1 => $error,\n 2 => $errormessage,\n 3 => $errorcode\n );\n \n return $output;\n }", "public function getVariants()\n {\n return array();\n }", "public function GetVariants()\r\n\t{\r\n\t\treturn $this->variant_model->GetAllBy(array(\"test_id\"=>$this->id));\r\n\t}", "public function getVoyagesAction()\n {\n $em = $this->getDoctrine()->getManager();\n $voyages = $em->getRepository('SiteBundle:Voyage')->findAll();\n\n return array('voyages' => $voyages);\n }", "public static function getAll() {}", "public function getWebTags() {\n\t\t$tags = $this->getTags();\n\t\t$webTags = array();\n\n\t\tfor($i = 0; $i < count($tags); $i++) {\n\t\t\tif($tags[$i] != 'spider') {\n\t\t\t\t$webTags[] = $tags[$i];\n\t\t\t}\n\t\t}\n\n\t\treturn $webTags;\n\t}", "public function getAll()\n {\n $sentence = new SentenceUtil();\n $sentence->fromCommand(\"/ip/hotspot/cookie/getall\");\n $this->talker->send($sentence);\n $rs = $this->talker->getResult();\n $i = 0;\n if ($i < $rs->size()) {\n return $rs->getResultArray();\n } else {\n return \"No IP Hotspot Cookie To Set, Please Your Add IP Hotspot Cookie\";\n }\n }", "public function getVariantList()\n {\n return $this->loadVariantInformation();\n }", "public function selectAllVocabulary() {\n $selectSQL = \"select id, type, value, uri, description from vocabulary;\";\n $result = $this->sdb->query($selectSQL, array());\n $allVocab = array();\n while ($row = $this->sdb->fetchrow($result)) {\n array_push($allVocab, $row);\n }\n return $allVocab;\n }", "public function listVirtualMachines() {\n\t\t$data = array (\n\t\t\t\t\"apiKey\" => $this->apiKey,\n\t\t\t\t\"command\" => \"listVirtualMachines\",\n\t\t\t\t\"response\" => \"json\"\n\t\t);\n\t\t$url = $this->getSignatureUrl ( $data );\n\t\treturn $this->curlGet ( $url );\n\t}", "public function index()\n {\n return Vaccination::all();\n }" ]
[ "0.68286383", "0.6376907", "0.62314326", "0.5824036", "0.57941246", "0.5788213", "0.5679018", "0.5477061", "0.5468979", "0.5415643", "0.5409313", "0.5405528", "0.53787196", "0.53449076", "0.5335248", "0.5329145", "0.5285081", "0.5281867", "0.5258363", "0.5246321", "0.52439815", "0.5219559", "0.5194655", "0.5186311", "0.5168147", "0.5142792", "0.5117359", "0.5115294", "0.51057875", "0.51055086" ]
0.84438014
0
Insert a new virus
public function insertOneVirus($someData) { $this->insertOne('VIRUSES', $someData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function insert($techHit);", "public function insert($banner);", "public function insert_guru($guru)\n {\n $q = $this->db->insert('t_guru', $guru);\n if ($q === true) {\n redirect('guru', 'refresh');\n } else {\n show_404();\n }\n }", "public function insert(){\n // Access-controlled resource\n if (!$this->_app->user->checkAccess('uri_drone_insert')){\n $this->_app->notFound();\n }\n // do something here\n }", "public function insert($gunBbl);", "private function insertNew() {\n $sth=NULL;\n $array=array();\n $query=\"INSERT INTO table_spectacles (libelle) VALUES (?)\";\n $sth=$this->dbh->prepare($query);\n $array=array($this->libelle);\n $sth->execute($array);\n $this->message=\"\\\"\".$this->getLibelle().\"\\\" enregistré !\";\n $this->blank();\n $this->test=1;\n }", "public function insert($otros_votos);", "public function insert($vendor);", "function insert() {\n $centinela = new Centinela();\n $flag = $centinela->accessTo('conf/conf_viazul_routes');\n if ($flag) {\n $result = $this->conn->insert();\n die($result);\n } else {\n $this->redirectError();\n }\n }", "function insertVoucher(){\n $db =new Database();\n $query=\"INSERT INTO `gutscheine`(`GutscheinID`, `Wert`, `Gueltigkeit`, `Eingeloest`) VALUES \"\n .\"('\".$this->gutscheinID.\"','\".$this->wert.\"','\".$this->gueltigkeit.\"','\".$this->eingeloest.\"')\";\n $db->insert($query);\n }", "public function insert($loyPrg);", "protected function _insert()\n {\n \n }", "protected function _insert()\n {\n \n }", "function insertGuest($insertArray){\n\t\t$insertArray['crdate'] = time();\n\t\t$insertArray['deleted'] = 0;\n\t\t$insertArray['hidden'] = 0;\n\t\t$insertArray['cruser_id'] = $GLOBALS[\"TSFE\"]->fe_user->user[\"uid\"];\n\t\t//t3lib_div::debug($insertArray,'insertGuest');\n\t\t$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_uniseminars_guests', $insertArray);\n\t\tif($GLOBALS['TYPO3_DB']->sql_error() != ''){\n\t\t\tt3lib_div::debug('Your registration could NOT be saved!','insertGuest');\n\t\t}\n\t}", "public static function insert()\n {\n }", "protected function _insert()\n\t{\n\t}", "public function insert($perifericos);", "public function inserir()\n {\n }", "public function insert_vaccine(Request $request)\n\t{\n\t\tVaccines::create([ 'name' => $request->input('new-vaccine') ]);\n\t\t\n\t\treturn back()->with('success', \"New Vaccine Record saved.\");\t\t\t\t\t\t\n\t}", "public function insert($bannerclient);", "public function insert() {\n \n }", "public function inschrijven()\n {\n $vrijwilliger = new stdClass();\n\n $deelnemer = $this->authex->getDeelnemerInfo();\n $vrijwilliger->deelnemerId = $deelnemer->id;\n $vrijwilliger->taakShiftId = $this->input->get('id');\n $vrijwilliger->commentaar = \"\";\n\n\n $this->HelperTaak_model->insertVrijwilliger($vrijwilliger);\n\n $personeelsfeestId = $this->input->get('personeelsfeestId');\n redirect(\"Vrijwilliger/HulpAanbieden/index/\" . $personeelsfeestId);\n }", "public function run()\n {\n DB::table('voters')->insert([\n 'ip' => '182.180.11.140'\n ]);\n }", "function insertFile ($filename, $origname='', $extraData='')\n{\n if (!$filename)\n v4b_exit ('Invalid filename passed to IbUtil::insertFile ...');\n\n if ($origname)\n $ext = FileUtil::getExtension ($origname);\n else\n $ext = FileUtil::getExtension ($filename);\n\n $data = '';\n $err = '';\n $cmd = '';\n global $v4bConfig;\n $txtFile = $v4bConfig['V4B_FILE_TMP_PATH'] . '/' . FileUtil::getBasename($filename) . '.txt';\n if ($ext == 'txt')\n $txtFile = $filename;\n else if ($ext == 'doc')\n $cmd = \"/usr/local/bin/antiword \\\"$filename\\\" > \\\"$txtFile\\\"\";\n else if ($ext == 'pdf')\n $cmd = \"pdftotext \\\"$filename\\\" \\\"$txtFile\\\"\";\n else if ($ext == 'ps')\n $cmd = \"ps2ascii \\\"$filename\\\" \\\"$txtFile\\\"\";\n else \n return -1;\n\n $rc = system ($cmd, $err);\n if ($err)\n return -1;\n\n $fp = fopen ($txtFile, \"a\");\n $swrite = \"\\nextraData\\n\";\n @fwrite ($fp, $swrite);\n fclose ($fp);\n\n $data = FileUtil::readFile ($txtFile);\n @unlink ($txtFile);\n\n if ($data)\n return IbUtil::insert ($data);\n\n return -1;\n}", "function registerRun(){\n if(in_array($this->imageFileType, $this->extensions_arr)){\n $sql = \"insert into rider (R_Name,R_Email,R_Password,R_Phone,R_License,\n R_Address,R_image)\n\n value(:R_Name, :R_Email, :R_Password, :R_Phone, :R_License, :R_Address, :R_image)\";\n\t\t\n\t\t $args = [':R_Name'=>$this->R_Name, ':R_Email'=>$this->R_Email, ':R_Phone'=>$this->R_Phone,\n ':R_License'=>$this->R_License,':R_Address'=>$this->R_Address, ':R_image'=>$this->R_image,\n ':R_Password'=>$this->R_Password];\n//print_r($sql);\n//exit();\n \n //Upload FIle \n move_uploaded_file($_FILES['photoFile']['tmp_name'], $this->target_dir.$this->R_image);\n\n $stmt = DB::run($sql, $args);\n $count = $stmt->rowCount();\n return $count;\n }\n }", "public function insert($tarConvenio);", "function insert() {\n\t \t \n\t \t$sql = \"INSERT INTO evs_database.evs_identification (idf_identification_detail_en, idf_identification_detail_th, idf_pos_id, idf_ctg_id)\n\t \t\t\tVALUES(?, ?, ?, ?)\";\n\t\t \n\t \t$this->db->query($sql, array($this->idf_identification_detail_en, $this->idf_identification_detail_th, $this->idf_pos_id, $this->idf_ctg_id));\n\t\n\t }", "public function insert(Tag $tag);", "function mINSERT(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$INSERT;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:19:3: ( 'insert' ) \n // Tokenizer11.g:20:3: 'insert' \n {\n $this->matchString(\"insert\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }", "function insert_audit_trail()\n {\n $parameter_array = $this->get_parameter_array();\n \n parent::insert('siis', $parameter_array);\n }" ]
[ "0.54496384", "0.54178363", "0.53684133", "0.53556806", "0.53550786", "0.53448313", "0.52415323", "0.52252394", "0.5142258", "0.5136719", "0.5113425", "0.50974315", "0.50974315", "0.50811434", "0.50734377", "0.507315", "0.50614625", "0.5011825", "0.5006102", "0.497314", "0.49729478", "0.4964063", "0.49552128", "0.49539626", "0.4939991", "0.49367145", "0.4923404", "0.49138933", "0.4909602", "0.4903893" ]
0.67055804
0
Recover the total number of viruses by name
public function getCountVirus() { return $this->getCount('VIRUSES', 'name'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCountVirusBy() {\n\t\treturn $this->getCountBy('VIRUSES', 'name');\n\t}", "public function getCountVirusId() {\n\t\treturn $this->getCount('VIRUSES', 'id');\n\t}", "public static function countOccurences($name)\n {\n $session = self::getSession();\n\n if (! isset($session->counts, $session->counts[$name])) {\n $session->counts[$name] = 1;\n } else {\n $session->counts[$name]++;\n }\n }", "public function countUsed()\n {\n }", "public function getReservedNameCount()\n {\n return $this->count(self::RESERVED_NAME);\n }", "function getNumberOfSpecies();", "function virustotalscan_info()\r\n{\r\n return array(\r\n\t\t\"name\"\t\t\t=> \"Virus Total Scanner\",\r\n\t\t\"description\"\t=> \"Scans new attachments and links by using VirusTotal.com's API.\",\r\n\t\t\"website\"\t\t=> \"http://mybb.ro\",\r\n\t\t\"author\"\t\t=> \"Surdeanu Mihai\",\r\n\t\t\"authorsite\"\t=> \"http://mybb.ro\",\r\n\t\t\"version\"\t\t=> \"1.1\",\r\n \"guid\" => \"1572096dc083bc7f00f2b4f5ae3837f7\",\r\n\t\t\"compatibility\"\t=> \"16*\"\r\n\t);\r\n}", "public function getAllViruses() {\n\t\treturn $this->selectAll('VIRUSES');\n\t}", "function spectra_address_count ()\n\t{\n\t\t$response = $GLOBALS[\"db\"][\"obj\"]->query (\"SELECT COUNT(*) AS `found` FROM `\".$GLOBALS[\"tables\"][\"ledger\"].\"` WHERE 1\");\n\t\t$result = $response->fetch_assoc ();\n\t\t\n\t\tif (!isset ($result[\"found\"]) || $result[\"found\"] == 0)\n\t\t{\n\t\t\treturn \"Unknown\";\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\treturn $result[\"found\"];\n\t\t}\n\t}", "public function findByNameCount(string $name): int\n {\n $exists = Kalyannaya::select('id')\n ->where('name', '=', $name)\n ->get()\n ->count();\n\n return $exists;\n }", "private function count()\n\t\t{\n\t\t\t$query = \"\tSELECT count(1) AS 'total'\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`\".$this->tree_node.\"` `MTN`\n\t\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t\t\tAND `MTN`.`application_release`\t= '\".$this->application_release.\"'\n\t\t\t\t\t\";\n\t\t\t$result = $this->link_mt->query($query);\n\n\t\t\t$row = $result->fetch_array(MYSQLI_ASSOC);\t\n\t\t\treturn $row['total'];\t\t\n\t\t}", "function count() ;", "public static function count();", "public function count() {\n $this->next();\n\n $names = [];\n while ($this->valid()) {\n $row_data = $this->current();\n $this->next();\n\n $names[] = $row_data['Name'];\n }\n $items = array_unique($names);\n $items = array_filter($items);\n\n return count($items);\n }", "public function countStored(): int;", "public function countNameservers(): int {}", "public function silverTrophyCount(): int\n {\n return $this->pluck('definedTrophies.silver');\n }", "function get_array_count( $name ){\n $settings = $this->get_settings();\n $name_len = mb_strlen($name);\n $cnt = 0;\n\n reset($settings);\n foreach( $settings as $key => $val ){\n if( substr($key, 0, $name_len) === $name ){\n ++$cnt;\n }\n }\n return $cnt;\n }", "public function count_inventory( $pBuffer = FALSE )\n\t{\n\t\ttry {\n\t\t\t$invsize = $this->steam_command(\n\t\t\t$this,\n\t\t\t\t\t\"get_size\",\n\t\t\tarray(),\n\t\t\t$pBuffer\n\t\t\t);\n\t\t} catch (steam_exception $e) { //this will happen on e.g. /home; function not allowed for this folder\n\t\t\t$invsize = sizeof($this->get_inventory());\n\t\t}\n\t\treturn $invsize;\n\t}", "function count(){}", "public function totalBuysQuantity(string $instrumentName): int\n {\n return 0;\n }", "public function holdingTankCount(){ return $this->APICall( 'holdingTankCount', \"Could not lookup web holding tank count\" ); }", "public function _count();", "function count_access($base_path, $name) {\r\n $filename = $base_path . DIRECTORY_SEPARATOR . \"stats.json\";\r\n $stats = json_decode(file_get_contents($filename), true);\r\n $stats[$name][mktime(0, 0, 0)] += 1;\r\n file_put_contents($filename, json_encode($stats, JSON_PRETTY_PRINT));\r\n}", "function countHit() {\n\n $this->saveField('hits', $this->data['Ringsite']['hits']+1, false);\n }", "public function goldTrophyCount(): int\n {\n return $this->pluck('definedTrophies.gold');\n }", "public function count();", "public function count();", "public function count();", "public function count();" ]
[ "0.77930135", "0.6778709", "0.5804429", "0.5520062", "0.5477595", "0.5468212", "0.54637015", "0.54510194", "0.5384852", "0.5327596", "0.532125", "0.5303181", "0.52912396", "0.52766085", "0.52672887", "0.52452993", "0.52140504", "0.5207936", "0.52041584", "0.5203091", "0.5187349", "0.5150446", "0.5134661", "0.51337165", "0.5114645", "0.5100475", "0.5099292", "0.5099292", "0.5099292", "0.5099292" ]
0.7909123
0
Retrieve the number of times each virus was detected
public function getCountVirusBy() { return $this->getCountBy('VIRUSES', 'name'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCountVirus() {\n\t\treturn $this->getCount('VIRUSES', 'name');\n\t}", "public function getCountVirusId() {\n\t\treturn $this->getCount('VIRUSES', 'id');\n\t}", "function getCount() {\n $this->putCount();\n //opens countlog.data to read the number of hits\n $datei = fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR .\"countlog.data\", \"r\");\n $count = fgets($datei, 1000);\n fclose($datei);\n return $count;\n }", "public function countGame() {\r\n\t\t$sql = new Sql();\r\n\t\t$result = $sql->Select(\"SELECT COUNT(*) as count FROM jogo\");\r\n\t\tif(count($result) > 0) {\r\n\t\t\t\r\n\t\t\t$count = ($result[0]['count']) / 16;\r\n\t\t\treturn ceil($count);\r\n\t\t}\r\n\t}", "function count() ;", "public static function count();", "function get_counts() {\n\t$artists = @file(\"/var/lib/musica/artists.count\");\n\t$albums = @file(\"/var/lib/musica/albums.count\");\n\t$songs = @file(\"/var/lib/musica/songs.count\");\n\t$counts = array(rtrim($artists[0]), rtrim($albums[0]), rtrim($songs[0]));\n\treturn $counts;\n}", "function virustotalscan_info()\r\n{\r\n return array(\r\n\t\t\"name\"\t\t\t=> \"Virus Total Scanner\",\r\n\t\t\"description\"\t=> \"Scans new attachments and links by using VirusTotal.com's API.\",\r\n\t\t\"website\"\t\t=> \"http://mybb.ro\",\r\n\t\t\"author\"\t\t=> \"Surdeanu Mihai\",\r\n\t\t\"authorsite\"\t=> \"http://mybb.ro\",\r\n\t\t\"version\"\t\t=> \"1.1\",\r\n \"guid\" => \"1572096dc083bc7f00f2b4f5ae3837f7\",\r\n\t\t\"compatibility\"\t=> \"16*\"\r\n\t);\r\n}", "function getUserCount(){\n try{\n $api = $this->routerosapi;\n $user = $this->devices->getUserRouter(array('id' => '1111'));\n $api->port = $user['port'];\n if($api->connect(\"10.10.10.1\",$user['username'],$user['password'])){\n $api->write('/ip/hotspot/host/print');\n $read = $api->read();\n $api->disconnect(); \n return count($read); \n }\n }catch(Exeption $error){\n return $error;\n }\n }", "public function iN_TotalVerificationRequests() {\n\t\t$q = mysqli_query($this->db, \"SELECT COUNT(*) AS verificationCount FROM i_verification_requests WHERE request_status = '0'\") or die(mysqli_error($this->db));\n\t\t$row = mysqli_fetch_array($q, MYSQLI_ASSOC);\n\t\tif ($row) {\n\t\t\treturn isset($row['verificationCount']) ? $row['verificationCount'] : '0';\n\t\t} else {return 0;}\n\t}", "public function count()\n {\n return $this->backgroundCheck\n ->count();\n }", "public function ultralinkCount(){ return $this->APICall( 'ultralinkCount', \"Could not retrieve the Ultralink count\" ); }", "function counterHits(){\n\tglobal $pth; include($pth['app']['globals']);\n\t$count \t\t= '';\n\t$counterHits= $pth['site']['counterHits'];\n\tclearstatcache();\n\tif(!is_file($counterHits)){ $handle\t= fopen($counterHits,'w'); fwrite($handle,'0'); fclose($handle); }\n\t// get current Hits + count\n\t$count\t= file_get_contents($counterHits);\n\tif(!$adm){\n\t\t$count = $count+1;\n\t\t// save Hits\n\t\t$files = fopen($counterHits,'w'); \n\t\tfwrite($files,$count);\n\t\tfclose($files);\n\t}\n\t\n\treturn '<p><strong>'.$count.'</strong> '.$txt['counterHits']['views'].'.</p>';\n}", "function count(){}", "public function countMatches() : int\n {\n return sizeof($this->getMatches());\n }", "private function count()\n\t\t{\n\t\t\t$query = \"\tSELECT count(1) AS 'total'\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`\".$this->tree_node.\"` `MTN`\n\t\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t\t\tAND `MTN`.`application_release`\t= '\".$this->application_release.\"'\n\t\t\t\t\t\";\n\t\t\t$result = $this->link_mt->query($query);\n\n\t\t\t$row = $result->fetch_array(MYSQLI_ASSOC);\t\n\t\t\treturn $row['total'];\t\t\n\t\t}", "function count();", "public static function getMonitorCount() : int {}", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();" ]
[ "0.78493", "0.73544276", "0.6004679", "0.5939721", "0.59321404", "0.5896587", "0.58024746", "0.5744334", "0.57226354", "0.5705141", "0.56638485", "0.5610544", "0.56093466", "0.55940825", "0.55922985", "0.55792344", "0.5572401", "0.5563391", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135", "0.55546135" ]
0.75359917
1
Recover the total number of viruses by id
public function getCountVirusId() { return $this->getCount('VIRUSES', 'id'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTotalnventory($id){\n\t$crud = new CRUD();\n\t$crud->connect();\n\n\t$crud -> sql(\"select *, COUNT(mortality_status) from pigs_tbl where mortality_status='alive' \");\n\t$r = $crud->getResult();\n\tforeach($r as $rs){\n\t\treturn $rs['COUNT(mortality_status)'];\n\t}\n\n\t$crud->disconnect();\n}", "public function getCountVirusBy() {\n\t\treturn $this->getCountBy('VIRUSES', 'name');\n\t}", "function getTotalVoucher($id){\n\t\t$t=0;\n\t\t$a = Voucher::all();\n\t\tforeach($a as $n){\n\t\t$dur= $a->amount;\n\t\t\n\t\t$r=$dur;\n\t\t$t = $t + $r;\n\t\t}\n\t\treturn $t;\n\t\t}", "function getCountOfTransferedNativePig($id){\n\t$crud = new CRUD();\n\t$crud->connect();\n\n\t$crud -> sql(\"SELECT *, COUNT(farmer_id_fk) FROM pigs_tbl WHERE farmer_id_fk='{$id}'\");\n\t$r = $crud->getResult();\n\tforeach($r as $rs){\n\t\treturn $rs['COUNT(farmer_id_fk)'];\n\t}\n\t$crud->disconnect();\n}", "public function dohvBrojSmestajaOglasavaca($id){\n return count($this->where('idVlasnik',$id)->findAll());\n }", "public function getCountVirus() {\n\t\treturn $this->getCount('VIRUSES', 'name');\n\t}", "public function countHoldings($icid) {\n $result = $this->connector->run(\"MATCH (c:Identity {id: '{$icid}'}) RETURN size((c)<-[:HIRELATION]-(:Resource)) as count\");\n $count = $result->getRecord()->get(\"count\");\n return $count;\n }", "function getSamplesCount($id){\n\t\n\t\t$query = 'SELECT count(*) AS SampleCount FROM samples As Sample \n\t\t\t\t LEFT JOIN minerals AS Mineral ON Sample.mineral_id=Mineral.id\n\t\t\t\t LEFT JOIN crystal_systems as CrystalSystem ON Mineral.crystal_system_id=CrystalSystem.id\n\t\t\t\t WHERE CrystalSystem.id = '.$id;\n\t\t\n\t\treturn $this->query($query);\n\t\n\t}", "static function adminGetVisitsCount($id)\r\n {\r\n if ($id)\r\n {\r\n $sql = \"SELECT COUNT(id) FROM metric_visits WHERE metric_id={$id} LIMIT 1\";\r\n $res = Yii::app()->db->createCommand($sql)->queryScalar();\r\n }\r\n return $res;\r\n }", "function consec_productobyID($id) {\n $sql = \"\n SELECT\n COUNT(idusuario)\n FROM vendedor\n WHERE idusuario=?;\";\n //$sql = $this->db->query($sql, array($id));\n \n //return $sql->simple_query(); //->total_cortes;\n }", "public function countVotes($id, $type)\n {\n \t$totalVotes = 0;\n\n $currentVotes = Vote::where('votable_id', '=', $id)->where('votable_type', $type)->get();\n \tforeach($currentVotes as $v)\n \t{\n \t\t$totalVotes += $v->vote;\n \t}\n\n \treturn $totalVotes;\n }", "function cognitivefactory_count_subs($id) {\n global $CFG, $DB;\n \n // counting direct subs\n $sql = \"\n SELECT \n COUNT(id)\n FROM \n {cognitivefactory_opdata}\n WHERE \n itemdest = {$id} AND\n operatorid = 'hierarchize'\n \";\n $res = $DB->count_records_sql($sql);\n return $res;\n}", "private function num_imagenes_anuncio($id){\n\t\t$anuncio_md5 = md5($id);\n\t\t$this->where('id_e',$anuncio_md5);\n\t\tif($salida_imagenes = $this->get('anuncios_img')){\n\t\t\t$count = count($salida_imagenes);\n\t\t\treturn $count;\n\t\t}else{\n\t\t\t\n\t\t\t$campos = array('apto' => '0');\n\t\t\t$this->where('id',$id);\n\t\t\t$this->update('anuncios',$campos);\n\t\t\treturn '0';\n\t\t}\n\t}", "public function findCountProd($id){\n return Product::where('id',$id)->first()->count;\n }", "public function countlineafactura($id)\n {\n $sql = \"SELECT COUNT(*) as totallinea FROM ventas_detalles VD\n INNER JOIN productos P \n ON VD.IDPROD = P.REFERENCIA\n WHERE VD.IDVENTA ='$id'\";\n return ejecutarConsulta($sql);\n }", "public function countAll($id) {\n $this->db->from($this->table);\n $this->db->where(\"merchId\", $id);\n return $this->db->count_all_results();\n }", "public function countForCode($id) {\n\t\treturn $this->queryCode($id)->count();\n\t}", "function tailoredtemp9($id) {\n return mysqli_query($this->conn, \"SELECT Count(*) as c FROM `ticket` JOIN `flight_instance` ON `ticket`.`id_fight`=`flight_instance`.`iid` WHERE `flight_instance`.`iid` = \".$id.\" GROUP BY (`ticket`.`id_fight`)\");\n }", "public function getCount($id) {\n\n $query = \"select * from scope where id=\" . $id;\n $result = mysqli_query($this->plink, $query);\n return mysqli_num_rows($result);\n }", "public function getTotalSubeixoRodovias(){\n\t\t$total = 0;\n\t\t$i=0;\n\t\twhile($i<count($this->result)){\n\t\t\tif($this->result[$i]->idn_digs == 1000)\n\t\t\t\t$total++;\n\t\t\t$i++;\n\t\t}\n\t\treturn $total;\n\t}", "public function modelTotalRecord(){\n $conn = Connection::getInstance();\n // thuc hien truy van\n $query = $conn->query(\"select id from inventory\");\n // tra ve so ban ghi\n return $query->rowCount();\n }", "function countChilds($id);", "public function totalCount();", "public function totalCount();", "public function countlend($id){\n\t\t\t$query=$this->db->where(['idlibro'=>$id])->from(\"prestamo\")->count_all_results();\n\t\t\treturn $query;\t\n\t\t}", "public function countStored(): int;", "function get_count_per_user($cu_id) {\n\t\t$count=0;\n\t\t$db=htvcenter_get_db_connection();\n\t\t$rs = $db->Execute(\"select count(pr_id) as num from \".$this->_db_table.\" where pr_cu_id=$cu_id\");\n\t\tif (!$rs) {\n\t\t\tprint $db->ErrorMsg();\n\t\t} else {\n\t\t\t$count = $rs->fields[\"num\"];\n\t\t}\n\t\treturn $count;\n\t}", "public function count_used($var_value_id)\n {\n $query=$this->db->select('*')->from('nvar_value')->where(array('var_value_id'=>$var_value_id));\n $res=$query->get();\n $result=$res->result_array();\n\n return count($result);\n }", "public function getTotalCount();", "public function getTotalCount();" ]
[ "0.685187", "0.67090595", "0.6562469", "0.64864653", "0.6359972", "0.62702894", "0.62613034", "0.6137624", "0.6110519", "0.604311", "0.6001232", "0.5933323", "0.59167963", "0.59153324", "0.5888431", "0.5870624", "0.5854248", "0.58107436", "0.579014", "0.5769571", "0.57181203", "0.5698624", "0.5659599", "0.5659599", "0.5643815", "0.56013155", "0.5593529", "0.55927116", "0.55609804", "0.55609804" ]
0.7643925
0
Find all classes which use a specific interface.
public function find(string $interface, ?string $directory = null, ?string $namespace = null): array;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function findImplements($interface);", "public function testCanFindClasses()\n {\n foreach ($this->classes as $class) {\n $this->assertTrue(class_exists($class) || interface_exists($class));\n }\n }", "static public function getInterfaces();", "function getClassesThatImplements($psrInterface, string $inNamespace = NULL, \\Closure $callback = NULL) : array\n {\n $store = \\Cache::driver();\n $key = md5($psrInterface);\n\n if ( \\Cache::supportsTags() ) {\n $store = \\Cache::tags([ 'classes_that_implements' ]);\n }\n\n return $store->get($key, function() use($key, $psrInterface, $inNamespace, $callback){\n $map = [];\n\n\n foreach ( getClassesInNamespace($inNamespace) as $class ) {\n if ( in_array($psrInterface, class_implements($class)) ) {\n if ( $callback ) {\n $map = array_merge($map, $callback($class));\n } else {\n $map[] = $class;\n }\n }\n }\n\n if(\\Cache::supportsTags()){\n \\Cache::tags(['classes_that_implements'])->forever($key, $map);\n }else{\n \\Cache::forever($key, $map);\n }\n\n return $map;\n });\n }", "public function getInterfaces() {}", "function getOwnInterfaces();", "#[@test]\n public function classImplementsComparatorInterface() {\n $class= $this->classloader->loadClass($this->classname);\n $interface= XPClass::forName('util.Comparator');\n $interfaces= new HashSet();\n $interfaces->addAll($class->getInterfaces());\n $this->assertTrue($interfaces->contains($interface));\n }", "public function classSet() {\n $set= new HashSet();\n for ($i= 0; $i < $this->interfaces->length; $i++) {\n $set->addAll($this->interfaces[$i]->classSet());\n }\n return $set->toArray();\n }", "public function find($class);", "public function findExtends($class);", "function discoverCandidateClasses($recursive = FALSE);", "public function findClass($class);", "abstract public function getClasses();", "function discoverExistingClasses($recursive = FALSE);", "public function getClasses();", "public function getClasses();", "public function getClasses();", "protected function getClassesToScan()\n\t{\n\t\t$classes = [];\n\n\t\tforeach ($this->scan as $class)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t$classes[] = new ReflectionClass($class);\n\t\t\t}\n\t\t\tcatch (Exception $e)\n\t\t\t{\n\t\t\t\t//\n\t\t\t}\n\t\t}\n\n\t\treturn $classes;\n\t}", "public static function getAllMikrotikInterfaces(){\n $mikrotiklibrary = new MikrotikLibrary();\n return $mikrotiklibrary->getAllMikrotikinterfaces();\n }", "function implementing($class, $interface) {\n $interfaces = class_implements($class);\n return isset($interfaces[$interface]);\n}", "protected function getClassImplementations()\n {\n }", "protected function getRegisteredClasses() {}", "protected function processSourceTree () {\n\t\t$this->processFileTree();\n\t\tforeach (get_declared_interfaces() as $interface) {\n\t\t$ref = new ReflectionClass($interface);\n\t\t\tif ($ref->isUserDefined()) {\n\t\t\t\t$this->classes[] = $ref;\n\t\t\t}\n\t\t}\n\t\tforeach (get_declared_classes() as $class) {\n\t\t\t$ref = new ReflectionClass($class);\n\t\t\tif ($ref->isUserDefined() && !preg_match('/^Spd/', $class)) {\n\t\t\t\t$this->classes[] = $ref;\n\t\t\t}\n\t\t}\n\t}", "public function implementsInterface($interface) {\n assert (is_string($interface));\n $refl = new \\ReflectionClass($this->name);\n return self::anyNameMatches($refl->getInterfaceNames(), $interface);\n }", "public function getClasses()\n {\n $conf_classes = config('larinterface.classes');\n $conf_directories = config('larinterface.directories');\n $conf_ignore = config('larinterface.ignore');\n\n $classesArray = [];\n\n // Forge classes\n foreach ($conf_classes as $output => $classes) {\n if (is_numeric($output)) {\n $output = 0;\n }\n\n if (is_string($classes)) {\n $classes = [$classes];\n }\n\n if (isset($classesArray[$output])) {\n $classesArray[$output] = array_merge($classesArray[$output], $classes);\n } else {\n $classesArray[$output] = $classes;\n }\n }\n\n // Forge directories\n foreach ($conf_directories as $output => $directories) {\n if (is_numeric($output)) {\n $output = 0;\n }\n\n if (is_string($directories)) {\n $directories = [$directories];\n }\n\n foreach ($directories as $directory) {\n $classes = $this->classFinder->findClasses(base_path($directory));\n\n if (isset($classesArray[$output])) {\n $classesArray[$output] = array_merge($classesArray[$output], $classes);\n } else {\n $classesArray[$output] = $classes;\n }\n }\n }\n\n // Clean forged class\n foreach ($classesArray as $key => $value) {\n\n // Ignore files\n foreach ($conf_ignore as $class) {\n $classKey = array_search($class, $value);\n\n if ($classKey !== false) {\n unset($value[$classKey]);\n }\n }\n\n $classesArray[$key] = array_unique($value);\n }\n\n return $this->classes = $this->extractInterfacePathFromClasses($classesArray);\n }", "public static function getInterfaces($path)\n {\n return preg_match('/class\\s+\\S+\\s+(?:extends\\s+\\S+\\s+)?implements\\s+([\\\\\\\\A-Za-z0-9,\\s]+)/Ss', static::getHead($path), $match)\n ? array_map('trim', explode(',', $match[1]))\n : array();\n }", "static function getUserInstanciableClasses(){\n \n //get all the classes\n $AllClasses=get_declared_classes();\n \n foreach($AllClasses as $Class):\n \n $class = new ReflectionClass($Class);\n \n if($class->isInstantiable() && $class->isUserDefined()):\n \n $InstanciableClasses[]=$Class;\n \n endif;\n \n \n endforeach;\n \n return $InstanciableClasses;\n \n \n }", "public static function instanceOf(string $class, string $interface)\n {\n return collect(class_implements($class))->contains($interface);\n }", "protected function setInterfaces()\n {\n if (count($this->interfaces) === 0) {\n return $this->interfaces;\n }\n\n ksort($this->interface_usage);\n ksort($this->interfaces);\n\n foreach ($this->interfaces as $interface) {\n\n $interface->implemented_by = array();\n $interface->dependency_for = array();\n\n if (isset($this->interface_usage[$interface->qns])) {\n $this->setInterfaceValues($interface, $interface->qns);\n }\n }\n\n return $this->interfaces;\n }", "private function filterProviders($interface)\n {\n $interface = '\\Oink\\Auth\\\\' . $interface;\n\n return array_filter($this->providers, function (AuthProviderInterface $provider) use ($interface) {\n return is_a($provider, $interface);\n });\n }" ]
[ "0.7555399", "0.65174675", "0.6384638", "0.6324269", "0.62958807", "0.61957365", "0.6189861", "0.612726", "0.6086555", "0.60527927", "0.6016066", "0.60035926", "0.5887741", "0.5831081", "0.5706686", "0.5706686", "0.5706686", "0.5640261", "0.56118613", "0.5598916", "0.55813915", "0.5567938", "0.5562744", "0.5543396", "0.5509712", "0.5507566", "0.5498166", "0.54375887", "0.5436571", "0.5429874" ]
0.6666894
1
Data provider for alpha values.
public function providerAlpha(): \Generator { // alpha, exception yield [64, false, false]; yield [0, false, false]; yield [127, false, false]; yield [-1, true, false]; yield [128, true, false]; yield [64.0, false, true]; yield ['64', false, true]; yield ['notanumber', false, true]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getAlpha() {\n\t\treturn $this->alpha;\n\t}", "public function getAlpha(): int\n {\n return $this->alpha;\n }", "public function setAlpha($alpha = 40) {\n\t\t$this->alpha = $alpha;\n\t}", "protected function parseAlpha()\n {\n if (!$this->matchString('(opacity=')) {\n return;\n }\n\n $value = $this->matchReg('/\\\\G[0-9]+/');\n if ($value === null) {\n $value = $this->parseEntitiesVariable();\n }\n\n if ($value !== null) {\n $this->expect(')');\n\n return new ILess_Node_Alpha($value);\n }\n }", "public function getAlpha()\n {\n $alpha = 100;\n if (strlen($this->argb) >= 6) {\n $dec = hexdec(substr($this->argb, 0, 2));\n $alpha = number_format(($dec / 255) * 100, 2);\n }\n\n return $alpha;\n }", "public function extensionKeyDataProvider() {}", "public function testIsAlpha() {\n $this->assertTrue(Hash::isAlpha(array('foo', 'bar')));\n $this->assertTrue(Hash::isAlpha(array('foo' => 'bar', 'number' => '123'), false));\n $this->assertTrue(Hash::isAlpha(array('bar', '123'), false));\n\n $this->assertFalse(Hash::isAlpha(array('foo' => 'bar', 'number' => '123')));\n $this->assertFalse(Hash::isAlpha(array('bar', '123')));\n $this->assertFalse(Hash::isAlpha(array('foo' => 123)));\n $this->assertFalse(Hash::isAlpha(array(null)));\n $this->assertFalse(Hash::isAlpha(array(true)));\n $this->assertFalse(Hash::isAlpha(array(false)));\n $this->assertFalse(Hash::isAlpha(array(array())));\n $this->assertFalse(Hash::isAlpha(array(new stdClass())));\n }", "public function IsAlpha () {\n\t\tif ($this->name === NULL) $this->GetName();\n\t\treturn $this->values[\\MvcCore\\IEnvironment::ALPHA];\n\t}", "private final function getLowerAlpha() {\n\t\t\treturn $this->lowerAlpha;\n\t\t}", "function _wp_tinycolor_bound_alpha($n)\n {\n }", "private function alpha($field, $value) {\n if (!preg_match(self::REGEX_ALPHA, $value)) {\n $this->errors[$field][] = self::ERROR_ALPHA;\n }\n }", "function SetAlpha($alpha, $bm='Normal')\n {\n // set alpha for stroking (CA) and non-stroking (ca) operations\n $gs = $this->AddExtGState(array('ca'=>$alpha, 'CA'=>$alpha, 'BM'=>'/'.$bm));\n $this->SetExtGState($gs);\n }", "function get_alpha_link($p_alpha) {\n\t\tglobal $db, $g_alpha;\n\t\t$p_alpha = strtoupper($p_alpha);\n\t\treturn ($p_alpha == $g_alpha) ? $p_alpha : '<a href=\"'.$_SERVER['PHP_SELF'].'?m=surnames&amp;alpha='.$p_alpha.'\">'.gtc($p_alpha).'</a>';\n\t}", "public function getValueReturnsCorrectValuesDataProvider() {}", "public function setAlpha($alpha = 100)\n {\n if ($alpha < 0) {\n $alpha = 0;\n }\n if ($alpha > 100) {\n $alpha = 100;\n }\n $alpha = round(($alpha / 100) * 255);\n $alpha = dechex((int) $alpha);\n $alpha = str_pad($alpha, 2, '0', STR_PAD_LEFT);\n $this->argb = $alpha . substr($this->argb, 2);\n\n return $this;\n }", "public function valuesProvider()\n {\n return array(\n // MilliMeter Cube\n array(VolumeConverter::class, 1000, \"-9\", 0.000001, \"-6\"),\n array(VolumeConverter::class, 123, \"-9\", 0.000000123, \"-9\"),\n array(VolumeConverter::class, 12.3456, \"-9\", 0.0000000123456, \"-9\"),\n // Centimenter Cube\n array(VolumeConverter::class, 1, \"-6\", 0.000001, \"-6\"),\n array(VolumeConverter::class, 12.3456, \"-6\", 0.0000123456, \"-6\"),\n array(VolumeConverter::class, 123.456, \"-6\", 0.000123456, \"-6\"),\n array(VolumeConverter::class, 1234.56, \"-6\", 0.00123456, \"-3\"),\n array(VolumeConverter::class, 0.1234, \"-6\", 0.0000001234, \"-9\"),\n array(VolumeConverter::class, 0.0123, \"-6\", 0.0000000123, \"-9\"),\n // Decimenter Cube\n array(VolumeConverter::class, 1, \"-3\", 0.001, \"-3\"),\n array(VolumeConverter::class, 12.3456, \"-3\", 0.0123456, \"-3\"),\n array(VolumeConverter::class, 123.456, \"-3\", 0.123456, \"-3\"),\n array(VolumeConverter::class, 0.12345, \"-3\", 0.00012345, \"-6\"),\n array(VolumeConverter::class, 0.01234, \"-3\", 0.00001234, \"-6\"),\n // Meters Cube\n array(VolumeConverter::class, 1, \"0\", 1, \"0\"),\n array(VolumeConverter::class, 1234.56, \"0\", 1234.56, \"0\"),\n array(VolumeConverter::class, 123.456, \"0\", 123.456, \"0\"),\n array(VolumeConverter::class, 0.123456, \"0\", 0.123456, \"-3\"),\n array(VolumeConverter::class, 0.012345, \"0\", 0.012345, \"-3\"),\n array(VolumeConverter::class, 0.001234, \"0\", 0.001234, \"-3\"),\n array(VolumeConverter::class, 0.000123, \"0\", 0.000123, \"-6\"),\n // Foot Cube\n array(VolumeConverter::class, 1, \"88\", 0.028317, \"-3\"),\n array(VolumeConverter::class, 123456, \"88\", 3495.884613, \"0\"),\n // Inch Cube\n array(VolumeConverter::class, 1, \"89\", 0.000016, \"-6\"),\n array(VolumeConverter::class, 123456, \"89\", 2.023081, \"0\"),\n // Ounce Cube\n array(VolumeConverter::class, 1, \"97\", 0.000029574, \"-6\"),\n array(VolumeConverter::class, 123456, \"97\", 3.651028, \"0\"),\n // Liter\n array(VolumeConverter::class, 1, \"98\", 0.001, \"-3\"),\n array(VolumeConverter::class, 123456, \"98\", 123.456, \"0\"),\n // Galon\n array(VolumeConverter::class, 1, \"99\", 0.00378541, \"-3\"),\n array(VolumeConverter::class, 123456, \"99\", 467.331577, \"0\"),\n );\n }", "public function provider()\n {\n return array(\n array('£3.99', '3.99'),\n array('$2.99 USD', '2.99'),\n array('€4,999,999.01', '4999999.01'),\n array('€4999999,01', '4999999.01'),\n );\n }", "public static function alphaChars()\n {\n return self::oneOf(\n self::choose(65, 90),\n self::choose(97, 122)\n )->fmap('chr');\n }", "public function valuesDataProvider()\n {\n return [\n 'new value' => [\n 'mynew_value',\n 'new value',\n 2,\n ],\n 'existing value' => [\n 'myvalue_id',\n 567,\n 1,\n ],\n 'exsiting value with attribute' => [\n 'myvalue_id',\n 'new value',\n 1,\n ],\n 'check name of attribute' => [\n '1',\n 123,\n 2,\n ],\n ];\n }", "private function createAlphaNumber() {\n $alphaNumberChars = \"0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM\";\n \n $alphaNumber = \"\";\n for($i = 0; $i < 60; $i++) {\n $randomIndex = rand(0, 61);\n $alphaNumber .= substr($alphaNumberChars, $randomIndex, 1);\n }\n \n $this->alphaNumValidation = $alphaNumber;\n }", "public function alpha(): static\r\n {\r\n if (!ctype_alpha($this->field)) $this->message(\"should be only alphabet\");\r\n return $this;\r\n }", "static function alphaNum( $st_data )\r\n {\r\n $st_data = preg_replace(\"([[:punct:]]| )\",'',$st_data);\r\n return $st_data;\r\n }", "public function hasAlphaChannel() {\n return $this->hasChannel(Constants::CHANNEL_ALPHA);\n }", "public function createDataProvider()\n {\n return [\n [1, 1, 0],\n [null, 0, 1]\n ];\n }", "public function stdWrap_stdWrapValueDataProvider() {}", "protected static function _alphaNumeric(){\n if (self::$_ruleValue) {\n $str = trim(self::$_elementValue);\n if (!preg_match('/[a-zA-z0-9]/', $str)) {\n self:: setErrorMessage(\"Alphanumeric only\");\n self::setInvalidFlag(true);\n } else {\n self::setInvalidFlag(false);\n }\n }\n }", "public function setAlphaValue( kaforkl_Position $position, $value )\n {\n $this->valueArray[$position->getX()][$position->getY()][self::ALPHA] = $value;\n }", "public function getAlphabet() {\n\t\t\treturn $this->alpha;\n\t\t}", "protected function _extractAlphaChannel($decodeParameters) {}", "public function defaultDataProvider()\n {\n return [\n [''],\n ['a'],\n [-1]\n ];\n }" ]
[ "0.68276244", "0.6300852", "0.613455", "0.5861539", "0.556578", "0.54387826", "0.5427365", "0.5409376", "0.54020447", "0.5388614", "0.5257902", "0.52430624", "0.5201882", "0.5140231", "0.5114709", "0.5105672", "0.50661224", "0.5065393", "0.50644565", "0.50623447", "0.5061345", "0.50569314", "0.5053627", "0.504508", "0.5043236", "0.5029815", "0.50226116", "0.501017", "0.5008194", "0.5001871" ]
0.7023818
0
Scales an image according to an image template, and stores it.
public function scaleAndStore($filename, $id, $template = null, $overwrite = false) { $templates = !is_null($template) ? (array)$template : // template is left empty; scale source file along all configured templates $templates = $this->getTemplateNames() ; $file = new Garp_Image_File(Garp_File::FILE_VARIANT_UPLOAD); $sourceData = $file->fetch($filename); $imageType = $file->getImageType($filename); foreach ($templates as $template) { $this->_scaleAndStoreForTemplate($sourceData, $imageType, $id, $template, $overwrite); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function image_scale($src_abspath, $dest_abspath, $aspect, $width, $strategy)\n{\n $im = new \\Imagick($src_abspath);\n $im = image_scale_im_obj($im, $aspect, $width, $strategy);\n return image_return_write($im, $dest_abspath);\n}", "protected function scaleImages() {}", "function do_scaled() {\n $this->layout = FALSE;\n\n $status = $this->show_scaled_image(IMAGE_RESOLUTION, 'photos');\n if (TRUE !== $status) {\n $this->message($status);\n $this->redirect('/photo/index');\n }\n }", "protected function processImage()\n {\n // Start from the last scale (bigger image).\n $tier = (count($this->_scaleInfo) - 1);\n $row = 0;\n $ul_y = 0;\n $lr_y = 0;\n\n list($root, $ext) = $this->getRootAndDotExtension($this->_imageFilename);\n\n // Create a row from the original image and process it.\n while ($row * $this->tileSize < $this->_originalHeight) {\n $ul_y = $row * $this->tileSize;\n $lr_y = ($ul_y + $this->tileSize < $this->_originalHeight)\n ? $ul_y + $this->tileSize\n : $this->_originalHeight;\n $saveFilename = $root . '-' . $tier . '-' . $row . '.' . $ext;\n $width = $this->_originalWidth;\n $height = abs($lr_y - $ul_y);\n $crop = [];\n $crop['width'] = $width;\n $crop['height'] = $height;\n $crop['x'] = 0;\n $crop['y'] = $ul_y;\n $this->imageResizeCrop($this->_imageFilename, $saveFilename, [], $crop);\n\n $this->processRowImage($tier, $row);\n ++$row;\n }\n }", "function image_scale_blob($blob, $aspect, $width, $strategy)\n{\n $im = new \\Imagick();\n $im->readImageBlob($blob);\n $im = image_scale_im_obj($im, $aspect, $width, $strategy);\n return image_return_blob($im);\n}", "function resize_image($src, $width, $height){\n // initializing\n $save_path = Wordless::theme_temp_path();\n $img_filename = Wordless::join_paths($save_path, md5($width . 'x' . $height . '_' . basename($src)) . '.jpg');\n\n // if file doesn't exists, create it\n if (!file_exists($img_filename)) {\n $to_scale = 0;\n $to_crop = 0;\n\n // Get orig dimensions\n list ($width_orig, $height_orig, $type_orig) = getimagesize($src);\n\n // get original image ... to improve!\n switch($type_orig){\n case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($src);\n break;\n case IMAGETYPE_PNG: $image = imagecreatefrompng($src);\n break;\n case IMAGETYPE_GIF: $image = imagecreatefromgif($src);\n break;\n default:\n return;\n }\n\n // which is the new smallest?\n if ($width < $height)\n $min_dim = $width;\n else\n $min_dim = $height;\n\n // which is the orig smallest?\n if ($width_orig < $height_orig)\n $min_orig = $width_orig;\n else\n $min_orig = $height_orig;\n\n // image of the right size\n if ($height_orig == $height && $width_orig == $width) ; // nothing to do\n // if something smaller => scale\n else if ($width_orig < $width) {\n $to_scale = 1;\n $ratio = $width / $width_orig;\n }\n else if ($height_orig < $height) {\n $to_scale = 1;\n $ratio = $height / $height_orig;\n }\n // if both bigger => scale\n else if ($height_orig > $height && $width_orig > $width) {\n $to_scale = 1;\n $ratio_dest = $width / $height;\n $ratio_orig = $width_orig / $height_orig;\n if ($ratio_dest > $ratio_orig)\n $ratio = $width / $width_orig;\n else\n $ratio = $height / $height_orig;\n }\n // one equal one bigger\n else if ( ($width == $width_orig && $height_orig > $height) || ($height == $height_orig && $width_orig > $width) )\n $to_crop = 1;\n // some problem...\n else\n echo \"ALARM\";\n\n // we need to zoom to get the right size\n if ($to_scale == 1) {\n $new_width = $width_orig * $ratio;\n $new_height = $height_orig * $ratio;\n $image_scaled = imagecreatetruecolor($new_width, $new_height);\n // scaling!\n imagecopyresampled($image_scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);\n $image = $image_scaled;\n\n if($new_width > $width || $new_height > $height)\n $to_crop = 1;\n }\n else {\n $new_width = $width_orig;\n $new_height = $height_orig;\n }\n\n // we need to crop the image\n if ($to_crop == 1) {\n $image_cropped = imagecreatetruecolor($width, $height);\n\n // find margins for images\n $margin_x = ($new_width - $width) / 2;\n $margin_y = ($new_height - $height) / 2;\n\n // cropping!\n imagecopy($image_cropped, $image, 0, 0, $margin_x, $margin_y, $width, $height);\n $image = $image_cropped;\n }\n\n // Save image\n imagejpeg($image, $img_filename, 95);\n }\n\n // Return image URL\n return Wordless::join_paths(Wordless::theme_temp_path(), basename($img_filename));\n }", "private function _scale()\n\t{\n\t\t//scale down the image by 55%\n\t\t$weaponImageSize = $this->weapon->getImageGeometry();\n\t\t$this->weaponScale['w'] = $weaponImageSize['width'] * 0.55;\n\t\t$this->weaponScale['h'] = $weaponImageSize['height'] * 0.55;\n\n\t\t$this->weapon->scaleImage($this->weaponScale['w'], $this->weaponScale['h']);\n\n\t\t//scale down the image by 30%\n\t\t$emblemImageSize = $this->emblem->getImageGeometry();\n\t\t$this->emblemScale['w'] = $emblemImageSize['width'] * 0.30;\n\t\t$this->emblemScale['h'] = $emblemImageSize['height'] * 0.30;\n\n\t\t$this->emblem->scaleImage($this->emblemScale['w'], $this->emblemScale['h']);\n\n\t\t//scale down the image by 70%\n\t\t$profileImageSize = $this->profile->getImageGeometry();\n\t\t$this->profileScale['w'] = $profileImageSize['width'] * 0.70;\n\t\t$this->profileScale['h'] = $profileImageSize['height'] * 0.70;\n\n\t\t$this->profile->scaleImage($this->profileScale['w'], $this->profileScale['h']);\n\t}", "private function resizeWithScaleExact($width, $height, $scale) {\n\t\t//$new_height = (int)($this->info['height'] * $scale);\n\t\t$new_width = $width * $scale;\n\t\t$new_height = $height * $scale;\n\t\t$xpos = 0;//(int)(($width - $new_width) / 2);\n\t\t$ypos = 0;//(int)(($height - $new_height) / 2);\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/gif' && $this->isAnimated) {\n $this->imagick = new Imagick($this->file);\n $this->imagick = $this->imagick->coalesceImages();\n foreach ($this->imagick as $frame) {\n $frame->thumbnailImage($new_width, $new_height);\n $frame->setImagePage($new_width, $new_height, 0, 0);\n }\n } else {\n $image_old = $this->image;\n $this->image = imagecreatetruecolor($width, $height);\n $bcg = $this->backgroundColor;\n\n if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') {\n imagealphablending($this->image, false);\n imagesavealpha($this->image, true);\n $background = imagecolorallocatealpha($this->image, $bcg[0], $bcg[1], $bcg[2], 127);\n imagecolortransparent($this->image, $background);\n } else {\n $background = imagecolorallocate($this->image, $bcg[0], $bcg[1], $bcg[2]);\n }\n\n imagefilledrectangle($this->image, 0, 0, $width, $height, $background);\n imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);\n imagedestroy($image_old);\n }\n\n\t\t$this->info['width'] = $width;\n\t\t$this->info['height'] = $height;\n }", "private function resize() {\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t$originalImage = imagecreatefromjpeg($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t$originalImage = imagecreatefrompng($this->tempName);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\t$originalImage = imagecreatefromgif($this->tempName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// Determine new height\n\t\t$this->newHeight = ($this->height / $this->width) * $this->newWidth;\n\n\t\t// Create new image\n\t\t$this->newImage = imagecreatetruecolor($this->newWidth, $this->newHeight);\n\n\t\t// Resample original image into new image\n\t\timagecopyresampled($this->newImage, $originalImage, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $this->width, $this->height);\n\n\t\t// Switch based on image being resized\n\t\tswitch($this->type) {\n\t\t\tcase 'image/jpeg':\n\t\t\t\t// Source, Dest, Quality 0 to 100\n\t\t\t\timagejpeg($this->newImage, $this->destinationFolder.'/'.$this->newName, 80);\n\t\t\tbreak;\n\t\t\tcase 'image/png':\n\t\t\t\t// Source, Dest, Quality 0 (no compression) to 9\n\t\t\t\timagepng($this->newImage, $this->destinationFolder.'/'.$this->newName, 0);\n\t\t\tbreak;\n\t\t\tcase 'image/gif':\n\t\t\t\timagegif($this->newImage, $this->destinationFolder.'/'.$this->newName);\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdie('YOUR FILE CANNOT BE RESIZED');\n\t\t\tbreak;\n\t\t}\n\n\t\t// DESTROY NEW IMAGE TO SAVE SERVER SPACE\n\t\timagedestroy($this->newImage);\n\t\timagedestroy($originalImage);\n\n\t\t// SUCCESSFULLY UPLOADED\n\t\t$this->result = true;\n\t\t$this->message = 'Image uploaded and resized successfully';\n\t}", "public function parseUATemplate($strBuffer, $strTemplate)\n\t{\n\t\t//Need to auto-adjust images that are too wide\n\t\tif(stripos($strTemplate, 'fe_') !== false && $this->blnMobile)\n\t\t{\n\t\t\t // Include SimpleHtmlDom\n\t\t\tif (!function_exists('file_get_html'))\n\t\t\t\trequire_once(TL_ROOT . '/system/modules/mobilecore/simple_html_dom.php');\n\t\t\t\t\n \t\t$objDoc = str_get_html($strBuffer);\n \t\t\n \t\t$intMaxWidth = $GLOBALS['UA_TYPES'][$this->strAgent]['maxImageWidth'];\n \t\t\n\t\t foreach($objDoc->find('img') as $tag) \n\t\t {\n\t\t $fileSrc = $tag->getAttribute('src');\n\t\t $blnAddDomainPrefix = false;\n\t\t $blnAddSubdomainPrefix = false;\n\t\t $strDomain = '';\n\t\t \n\t\t //Check for subdomain settings\n\t\t if(stripos($fileSrc,TL_FILES_URL)!==false)\n\t\t {\n\t\t \t\t$blnAddSubdomainPrefix = true;\n\t\t \t\t$strURL = parse_url($fileSrc);\n\t\t \t\t$fileSrc = substr($strURL['path'],1);\n\t\t }\n\t\t //Check for external URL or one that we may not be able to resize\n\t\t elseif( stripos($fileSrc,'http')!==false )\n\t\t {\n\t\t\t \t$strURL = parse_url($fileSrc);\n\t\t\t \t//Check to see if it is on the same domain and file exists... If so we can resize it.\n\t\t\t \tif (file_exists(TL_ROOT . $strURL['path']))\n\t\t\t\t\t{\n\t\t\t\t\t\t$fileSrc = substr($strURL['path'],1);\n\t\t\t\t\t\t$strDomain = $strURL['scheme'] . '//:' . $strURL['host'];\n\t\t\t\t\t}\n\t\t\t\t\t//Otherwise we have an external image\n\t\t\t\t\telse\n\t\t\t\t\t{\t\n\t\t\t\t\t\t//All we can do here with external images is reset and set the width attribute\n\t\t\t\t\t\t$tag->removeAttribute('width');\n\t\t\t\t\t\t$tag->removeAttribute('height');\n\t\t\t\t\t\t$tag->setAttribute('width', $intMaxWidth);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t }\n\t\t \n\t\t $objFile = new File($fileSrc);\n\t\t $blnResize = (($tag->hasAttribute('width') && $tag->getAttribute('width') > $intMaxWidth) || (!$tag->hasAttribute('width') && $objFile->width > $intMaxWidth)) ? true : false;\n\t\t \t\t \n\t\t if($blnResize)\n\t\t {\n\t\t \t \t$src = $this->urlEncode($fileSrc);\n\t\t \t \t$width = $intMaxWidth;\n\t\t \t \t$height = '';\n\t\t \t \t$mode = 'proportional'; //@todo - Make configurable in settings\n\t\t \t \t$strCacheName = 'system/html/' . $objFile->filename . '-'.$this->strAgent.'-' . substr(md5('-w' . $width . '-h' . $height . '-' . $tag->getAttribute('src') . '-' . $mode . '-' . $objFile->mtime), 0, 8) . '.' . $objFile->extension;\n\t\t \t \n\t\t\t\t\t// Return the path of the new image if it exists already\n\t\t\t\t\tif (file_exists(TL_ROOT . '/' . $strCacheName))\n\t\t\t\t\t{\n\t\t\t\t\t\t$newImage = $strCacheName;\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$newImage = $this->getUAImage($src, $width, $height, $mode, $strCacheName, $objFile);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$newImageSrc = $blnAddSubdomainPrefix ? TL_FILES_URL. '/' .$newImage : ( $blnAddDomainPrefix ? $strDomain . '/' . $newImage : $newImage);\n\t\t\t\t\t\n\t\t\t \t$tag->setAttribute('src', $newImageSrc);\n\t\t\t \t$tag->removeAttribute('width');\n\t\t\t \t$tag->removeAttribute('height');\n\t\t\t }\n\t\t }\n\t\t \n\t\t $strBuffer = $objDoc->save();;\n\t\t \t\t \t\t\n\t\t}\n\t\t//HOOK for other mobile parsing - will have more options for this later\n\t\tif (isset($GLOBALS['TL_HOOKS']['outputUATemplate']) && is_array($GLOBALS['TL_HOOKS']['outputUATemplate']))\n\t\t{\n\t\t\tforeach ($GLOBALS['TL_HOOKS']['outputUATemplate'] as $callback)\n\t\t\t{\n\t\t\t\t$this->import($callback[0]);\n\t\t\t\t$strBuffer = $this->$callback[0]->$callback[1]($strBuffer, $strTemplate, $this);\n\t\t\t}\n\t\t}\n\t\t\t\n\t \treturn $strBuffer;\n\t}", "public function createImage()\n {\n if ($this->resize) {\n\n // get the resize dimensions\n $height = (int)array_get($this->resizeDimensions, 'new_height', 320);\n\n $width = (int)array_get($this->resizeDimensions, 'new_width', 240);\n\n if ($this->fit) {\n return Image::make($this->originalPath)->fit($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n } else {\n return Image::make($this->originalPath)->resize($width, $height)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n\n } else {\n\n return Image::make($this->originalPath)\n ->save(base_path() . $this->storageLocation . '/' . $this->uniqueName, $this->imgQuality);\n }\n }", "function create_medium($type, $image){\r\n\techo $source_path=DIR_FS_SITE.'upload/photo/'.$type.'/large/'.$image;\r\n\techo $destination_path=DIR_FS_SITE.'upload/photo/'.$type.'/medium/'.$image;\r\n\tlist($width, $height) = getimagesize($source_path);\r\n $xscale=$width/MEDIUM_WIDTH;\r\n $yscale=$height/MEDIUM_HEIGHT;\r\n \r\n // Recalculate new size with default ratio\r\n if ($yscale>$xscale){\r\n $new_width = round($width * (1/$yscale));\r\n $new_height = round($height * (1/$yscale));\r\n }\r\n else {\r\n $new_width = round($width * (1/$xscale));\r\n $new_height = round($height * (1/$xscale));\r\n }\r\n\r\n #check image format and create image\r\n if(strtolower(substr($source_path, -3))=='jpg'):\r\n $imageTmp = imagecreatefromjpeg ($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='gif'):\r\n $imageTmp = imagecreatefromgif($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='png'):\r\n $imageTmp = imagecreatefrompng($source_path);\r\n endif;\r\n\r\n // Resize the original image & output\r\n $imageResized = imagecreatetruecolor($new_width, $new_height);\r\n # $imageTmp = imagecreatefromjpeg ($source_path);\r\n imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\r\n output_img($imageResized, image_type_to_mime_type(getimagesize($source_path)), $destination_path);\r\n}", "public function generate($cache = true)\n {\n if ($cache)\n {\n $d = $this->cache_get();\n if ($d) return $d;\n }\n\n $src_img = $this->image->load();\n\n // get image info - TODO: error handling\n $size = getimagesize($this->image->file->path);\n $exif = $this->image->get_exif();\n\n $src_width = $size[0];\n $src_height = $size[1];\n $max_width = $this->max_width;\n $max_height = $this->max_height;\n\n // shall be rotated? switch width/height temporarily and rotate after image has been scaled\n $rotation = $exif->get_rotation();\n if ($rotation) {\n $t = $max_height;\n $max_height = $max_width;\n $max_width = $t;\n }\n\n // calculate new size\n if ($src_width / $src_height > $max_width / $max_height) {\n $new_width = $max_width;\n $new_height = round($max_width / $src_width * $src_height);\n } else {\n $new_height = $max_height;\n $new_width = round($max_height / $src_height * $src_width);\n }\n\n // create new image\n $new_img = imagecreatetruecolor($new_width, $new_height);\n\n // copy to new image\n imagecopyresampled($new_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $src_width, $src_height);\n imagedestroy($src_img);\n\n // rotate?\n if ($rotation) {\n $rotated = imagerotate($new_img, $rotation, 0);\n imagedestroy($new_img);\n $new_img = $rotated;\n\n // switch width/height back\n #$t = $new_height;\n #$new_height = $new_width;\n #$new_width = $t;\n }\n\n // catch output\n ob_start();\n ob_clean();\n imagejpeg($new_img, null, $this->quality);\n imagedestroy($new_img);\n\n $data = ob_get_contents();\n ob_clean();\n\n // save cache\n $this->cache_save($data);\n\n return $data;\n }", "protected function saveImage()\n {\n if ( $this->initialImage != $this->image )\n {\n $this->deleteOldImage();\n\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n $imageHandler->save($this->getImagesFolder( TRUE ) . $imageHandler->getBaseFileName() );\n\n $settings = $this->getThumbsSettings();\n\n if ( !empty( $settings ) )\n {\n $imageHandler= new CImageHandler();\n $imageHandler->load( $this->getTempFolder( TRUE ) . $this->image );\n\n foreach( $settings as $prefix => $dimensions )\n {\n list( $width, $height ) = $dimensions;\n $imageHandler\n ->thumb( $width, $height )\n ->save( $this->getImagesFolder( TRUE ) . $prefix . $imageHandler->getBaseFileName() );\n }\n }\n\n @unlink( $this->getTempFolder( TRUE ) . $this->image );\n }\n }", "protected function _createImage()\n {\n $this->_height = $this->scale * 60;\n $this->_width = 1.8 * $this->_height;\n $this->_image = imagecreate($this->_width, $this->_height);\n ImageColorAllocate($this->_image, 0xFF, 0xFF, 0xFF);\n }", "public function scale_image($x, $y)\n\t{\n $newimage = imagecreatetruecolor($x, $y); // defaults to filled with black\n $image_size = $this->image_size();\n if ($image_size[0] > $image_size[1]) {\n // Wide image, we want to resize the image with a letterbox\n $width = $x;\n $height = ($image_size[1] * $x) / $image_size[0];\n $oldimage = $this->load_image();\n $y = ($y - $height) / 2;\n $x = 0;\n } else {\n // Tall image, we want to resize the image with a pillarbox\n $height = $y;\n $width = ($image_size[0] * $y) / $image_size[1];\n $oldimage = $this->load_image();\n $y = 0;\n $x = ($x - $width) / 2;\n }\n imagecopyresampled($newimage, $oldimage, $x, $y, 0, 0, $width, $height, $image_size[0], $image_size[1]);\n $filename = tempnam(sys_get_temp_dir(), 'img');\n if (preg_match('/jpeg/', $image_size['mime'])) {\n imagejpeg($newimage, $filename, 100);\n } elseif (preg_match('/gif/', $image_size['mime'])) {\n imagegif($newimage, $filename);\n } elseif (preg_match('/png/', $image_size['mime'])) {\n imagepng($newimage, $filename);\n }\n $this->delete_local_file();\n $this->local_file = $filename;\n\t}", "public function generateTemplateScaledImages($filename, $id, $overwrite = false) {\n\t\tif ($filename && $id) {\n\t\t\t$templates = $this->getTemplateNames();\n\n\t\t\tforeach ($templates as $t) {\n\t\t\t\ttry {\n\t\t\t\t\t$this->scaleAndStore($filename, $id, $t, $overwrite);\n\t\t\t\t} catch(Exception $e) {\n\t\t\t\t\tthrow new Exception(\"Error scaling \".$filename.\" (#\".$id.\"): \".$e->getMessage());\n\t\t\t\t}\n\t\t\t}\n\t\t} else throw new Exception('A filename and id were not provided. Filename ['.$filename.'] Id ['.$id.']');\n\t}", "abstract public function storeThumbnail(ImageFile $file, $x, $y);", "public function thumbnail($params, &$smarty) {\r\n\t\tif (!isset($params['image']) || empty($params['image']) || !file_exists($_SERVER['DOCUMENT_ROOT'].$params['image'])) return $params['image'];\r\n\t\t$image = trim($params['image']);\r\n\t\tunset($params['image']);\r\n\r\n\t\t$defaults = array('width' => 0, 'height' => 0, 'type' => 'fit', 'position' => 'center');\r\n\t\t$params = $params + $defaults;\r\n\t\tif (!in_array($params['type'], array('fit', 'crop', 'stretch', 'max'))) $params['type'] = 'fit';\r\n\t\tksort($params);\r\n\t\tif ($params['width'] == 0 && $params['height'] == 0) return $image;\r\n\r\n\t\t$pathinfo = pathinfo($_SERVER['DOCUMENT_ROOT'].$image);\r\n\t\t$directory = $pathinfo['dirname'].'/cache/';\r\n\t\t$filename = $pathinfo['filename'].'_'.implode('_', $params).'.png';\r\n\t\tif (!file_exists($directory.$filename) || filectime($_SERVER['DOCUMENT_ROOT'].$image) > filectime($directory.$filename)) {\r\n\t\t\tif (extension_loaded('imagick') && class_exists('Imagick')) {\r\n\t\t\t\t$im = new Imagick();\r\n\t\t\t\t$im->setResourceLimit( Imagick::RESOURCETYPE_MEMORY, 25 );\r\n\t\t\t\ttry {\r\n\t\t\t\t\t$im->readImage($_SERVER['DOCUMENT_ROOT'].$image);\r\n\t\t\t\t} catch(ImagickException $e) {\r\n\t\t\t\t\treturn $image;\r\n\t\t\t\t}\r\n\t\t\t\t$canvas = $this->resizeImage($im, $params);\r\n\t\t\t\t$canvas->writeImage($directory.$filename);\r\n\t\t\t\t$im->destroy();\r\n\t\t\t\t$canvas->destroy();\r\n\t\t\t} else {\r\n\t\t\t\treturn $image;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn dirname($image).'/cache/'.$filename;\r\n\t}", "function resizeImage($image,$width,$height,$scale,$stype) {\n\t$newImageWidth = ceil($width * $scale);\n\t$newImageHeight = ceil($height * $scale);\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\tswitch($stype) {\n case 'gif':\n $source = imagecreatefromgif($image);\n break;\n case 'jpg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'jpeg':\n $source = imagecreatefromjpeg($image);\n break;\n case 'png':\n $source = imagecreatefrompng($image);\n break;\n }\n\timagecopyresampled($newImage, $source,0,0,0,0, $newImageWidth, $newImageHeight, $width, $height);\n\timagejpeg($newImage,$image,90);\n\tchmod($image, 0777);\n\treturn $image;\n}", "private function generate()\n {\n $originalImages = Storage::files(env('PHOTO_PATH'));\n\n foreach ($originalImages as $originalImage) {\n $pieces = explode('/', $originalImage);\n\n $exp = explode('.', end($pieces));\n\n $extension = end($exp);\n\n array_pop($exp);\n\n $imageId = implode('.', $exp);\n\n $photos = [];\n\n foreach ($this->dimensions as $key => $dimension) {\n $fileName = env('PHOTO_PATH_RESIZE') . \"{$imageId}_{$key}.$extension\";\n\n if (! Storage::exists($fileName)) {\n $img = Image::make(Storage::get($originalImage));\n $img->resize($dimension['width'], $dimension['height']);\n\n Storage::put($fileName, (string)$img->encode(), 'public');\n\n if (Storage::exists($fileName)) {\n $photos[$key] = asset(Storage::url($fileName));\n }\n }\n }\n\n /**\n * Save on Storage\n */\n if (count($photos)) {\n $photo = new Photo();\n $photo->name = $imageId;\n $photo->photos = $photos;\n $photo->photos = $photos;\n $photo->save();\n }\n }\n }", "public function action_image()\n\t{\n\t\t//Image::load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')->preset('mypreset', DOCROOT.'/files/04_2021/ea7e8ed4bc9d6f7c03f5f374e30b183b.png');\n\t\t$image = Image::forge();\n\n\t\t// Or with optional config\n\t\t$image = Image::forge(array(\n\t\t\t\t'quality' => 80\n\t\t));\n\t\t$image->load(DOCROOT.'/files/04_2021/79199dcc06baf4cc230262fcbb4d1094.jpg')\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->rounded(100)\n\t\t\t\t\t->output();\n\t\t// Upload an image and pass it directly into the Image::load method.\n\t\tUpload::process(array(\n\t\t\t'path' => DOCROOT.DS.'files'\n\t\t));\n\n\t\tif (Upload::is_valid())\n\t\t{\n\t\t\t$data = Upload::get_files(0);\n\n\t\t\t// Using the file upload data, we can force the image's extension\n\t\t\t// via $force_extension\n\t\t\tImage::load($data['file'], false, $data['extension'])\n\t\t\t\t\t->crop_resize(200, 200)\n\t\t\t\t\t->save('image');\n\t\t} \n\t}", "function resizeImage($image,$width,$height,$scale) {\n\t\t\t\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t\t\t\t$imageType = image_type_to_mime_type($imageType);\n\t\t\t\t$newImageWidth = ceil($width * $scale);\n\t\t\t\t$newImageHeight = ceil($height * $scale);\n\t\t\t\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\t\t\t\tswitch($imageType) {\n\t\t\t\t\tcase \"image/gif\":\n\t\t\t\t\t\t$source=imagecreatefromgif($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/pjpeg\":\n\t\t\t\t\tcase \"image/jpeg\":\n\t\t\t\t\tcase \"image/jpg\":\n\t\t\t\t\t\t$source=imagecreatefromjpeg($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/png\":\n\t\t\t\t\tcase \"image/x-png\":\n\t\t\t\t\t\t$source=imagecreatefrompng($image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\timagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);\n\t\t\t\n\t\t\t\tswitch($imageType) {\n\t\t\t\t\tcase \"image/gif\":\n\t\t\t\t\t\timagegif($newImage,$image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/pjpeg\":\n\t\t\t\t\tcase \"image/jpeg\":\n\t\t\t\t\tcase \"image/jpg\":\n\t\t\t\t\t\timagejpeg($newImage,$image,90);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/png\":\n\t\t\t\t\tcase \"image/x-png\":\n\t\t\t\t\t\timagepng($newImage,$image);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t\t\tchmod($image, 0777);\n\t\t\t\treturn $image;\n\t\t\t}", "private function makeImageSize(): void\n {\n list($width, $height) = getimagesize($this->getUrl());\n $size = array('height' => $height, 'width' => $width );\n\n $this->width = $size['width'];\n $this->height = $size['height'];\n }", "public function save(array $options = []) {\n/* if (preg_match('/image/', $this->mime_type)) {\n $this->isImage = true;\n $manager = new ImageManager(array('driver' => 'gd'));\n $image = Storage::disk('public')->get($this->myFile);\n $imageOrig = $manager->make($image); \n //Get width and height of the image\n $this->img_width = $imageOrig->width();\n $this->img_height = $imageOrig->height();\n }*/\n parent::save($options);\n $this->createThumbs();\n }", "function _createThumbnail()\r\n\t{\r\n\t\t$user=$this->auth(PNH_EMPLOYEE);\r\n\t\t$config['image_library']= 'gd';\r\n\t\t$config['source_image']= './resources/employee_assets/image/';\r\n\t\t$config['create_thumb']= TRUE;\r\n\t\t$config['maintain_ratio']= TRUE;\r\n\t\t$config['width']= 75;\r\n\t\t$config['height']=75;\r\n\r\n\t\t$this->image_lib->initialize($config);\r\n\r\n\t\t$this->image_lib->resize();\r\n\r\n\t\tif(!$this->image_lib->resize())\r\n\t\t\techo $this->image_lib->display_errors();\r\n\t}", "function resizeImage($image,$width,$height,$scale) {\n\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t$imageType = image_type_to_mime_type($imageType);\n\t$newImageWidth = ceil($width * $scale);\n\t$newImageHeight = ceil($height * $scale);\n\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\tswitch($imageType) {\n\t\tcase \"image/gif\":\n\t\t\t$source=imagecreatefromgif($image); \n\t\t\tbreak;\n\t case \"image/pjpeg\":\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t\t\t$source=imagecreatefromjpeg($image); \n\t\t\tbreak;\n\t case \"image/png\":\n\t\tcase \"image/x-png\":\n\t\t\t$source=imagecreatefrompng($image); \n\t\t\tbreak;\n \t}\n\timagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);\n\t\n\tswitch($imageType) {\n\t\tcase \"image/gif\":\n\t \t\timagegif($newImage,$image); \n\t\t\tbreak;\n \tcase \"image/pjpeg\":\n\t\tcase \"image/jpeg\":\n\t\tcase \"image/jpg\":\n\t \t\timagejpeg($newImage,$image,90); \n\t\t\tbreak;\n\t\tcase \"image/png\":\n\t\tcase \"image/x-png\":\n\t\t\timagepng($newImage,$image); \n\t\t\tbreak;\n }\n\t\n\tchmod($image, 0777);\n\treturn $image;\n}", "public function resizeImage($filepath) {\n if (is_file($filepath)) {\n \n $dir_name = $this->destinationDirectory;\n\n $drawable_dpi = array();\n $drawable_dpi['drawable-ldpi'] = 0.1875;\n $drawable_dpi['drawable-mdpi'] = 0.25;\n $drawable_dpi['drawable-hdpi'] = 0.375;\n $drawable_dpi['drawable-xhdpi'] = 0.5;\n $drawable_dpi['drawable-xxhdpi'] = 0.75;\n $drawable_dpi['drawable-xxxhdpi'] = 1.0;\n\n $mipmap_dpi = array();\n $mipmap_dpi['mipmap-ldpi'] = 0.1875;\n $mipmap_dpi['mipmap-mdpi'] = 0.25;\n $mipmap_dpi['mipmap-hdpi'] = 0.375;\n $mipmap_dpi['mipmap-xhdpi'] = 0.5;\n $mipmap_dpi['mipmap-xxhdpi'] = 0.75;\n $mipmap_dpi['mipmap-xxxhdpi'] = 1.0;\n\n $selected_dpi = array();\n if($this->folderCode == 0) {\n $selected_dpi = $drawable_dpi; \n }\n if($this->folderCode == 1) {\n $selected_dpi = $mipmap_dpi; \n }\n if($this->folderCode == 2) {\n $selected_dpi = array_merge($drawable_dpi, $mipmap_dpi); \n }\n\n\n // Content type\n $image_ext = \"png\";\n header('\"Content-Type: image/\"'.$image_ext);\n\n // Get new sizes\n $dir_path = $this->dirHelper($dir_name);\n $imageFileName = $this->extract_file_name($filepath);\n $final_dir_path = $dir_path.\"res/\"; \n if (!is_dir($final_dir_path)) {\n mkdir($final_dir_path);\n }\n foreach ($selected_dpi as $key => $value) {\n if (!is_dir($final_dir_path.$key)) {\n mkdir($final_dir_path.$key);\n }\n list($width, $height) = getimagesize($filepath);\n $newwidth = $width * $value;\n $newheight = $height * $value;\n\n // Load\n $thumb = imagecreatetruecolor($newwidth, $newheight);\n $source = imagecreatefrompng($filepath);\n\n // Resize\n imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);\n imagepng($thumb, $final_dir_path.$key.\"/\".$imageFileName);\n }\n echo \"<h1>$filepath has been resized into different sizes</h1>\";\n }\n elseif(!file_exists($filepath)) {\n echo \"<h1>Invalid File path</h1>\";\n }\n else {\n echo \"<h1>This is not a file</h1>\";\n }\n\n }", "function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){\n\t\tlist($imagewidth, $imageheight, $imageType) = getimagesize($image);\n\t\t$imageType = image_type_to_mime_type($imageType);\n\t\t\n\t\t$newImageWidth = ceil($width * $scale);\n\t\t$newImageHeight = ceil($height * $scale);\n\t\t$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);\n\t\tswitch($imageType) {\n\t\t\tcase \"image/gif\":\n\t\t\t\t$source=imagecreatefromgif($image); \n\t\t\t\tbreak;\n\t\t\tcase \"image/pjpeg\":\n\t\t\tcase \"image/jpeg\":\n\t\t\tcase \"image/jpg\":\n\t\t\t\t$source=imagecreatefromjpeg($image); \n\t\t\t\tbreak;\n\t\t\tcase \"image/png\":\n\t\t\tcase \"image/x-png\":\n\t\t\t\t$source=imagecreatefrompng($image); \n\t\t\t\tbreak;\n\t\t}\n\t\timagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);\n\t\tswitch($imageType) {\n\t\t\tcase \"image/gif\":\n\t\t\t\timagegif($newImage,$thumb_image_name); \n\t\t\t\tbreak;\n\t\t\tcase \"image/pjpeg\":\n\t\t\tcase \"image/jpeg\":\n\t\t\tcase \"image/jpg\":\n\t\t\t\timagejpeg($newImage,$thumb_image_name,90); \n\t\t\t\tbreak;\n\t\t\tcase \"image/png\":\n\t\t\tcase \"image/x-png\":\n\t\t\t\timagepng($newImage,$thumb_image_name); \n\t\t\t\tbreak;\n\t\t}\n\t\tchmod($thumb_image_name, 0777);\n\t\treturn $thumb_image_name;\n\t}", "function create_thumb($type, $image){\r\n\techo $source_path=DIR_FS_SITE.'upload/photo/'.$type.'/large/'.$image;\r\n\techo $destination_path=DIR_FS_SITE.'upload/photo/'.$type.'/thumb/'.$image;\r\n\tlist($width, $height) = getimagesize($source_path);\r\n $xscale=$width/THUMB_WIDTH;\r\n $yscale=$height/THUMB_HEIGHT;\r\n \r\n // Recalculate new size with default ratio\r\n if ($yscale>$xscale){\r\n $new_width = round($width * (1/$yscale));\r\n $new_height = round($height * (1/$yscale));\r\n }\r\n else {\r\n $new_width = round($width * (1/$xscale));\r\n $new_height = round($height * (1/$xscale));\r\n }\r\n\r\n // Resize the original image & output\r\n $imageResized = imagecreatetruecolor($new_width, $new_height);\r\n\r\n #check image format and create image\r\n if(strtolower(substr($source_path, -3))=='jpg'):\r\n $imageTmp = imagecreatefromjpeg ($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='gif'):\r\n $imageTmp = imagecreatefromgif($source_path);\r\n elseif(strtolower(substr($source_path, -3))=='png'):\r\n $imageTmp = imagecreatefrompng($source_path);\r\n endif;\r\n\r\n imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\r\n output_img($imageResized, image_type_to_mime_type(getimagesize($source_path)), $destination_path);\r\n}" ]
[ "0.65270466", "0.64864707", "0.6107725", "0.6106328", "0.6074078", "0.5992324", "0.58887035", "0.58242536", "0.582168", "0.58132875", "0.5789498", "0.57548535", "0.57490224", "0.57387966", "0.5704424", "0.5661739", "0.5659689", "0.5622696", "0.56223285", "0.5608702", "0.5559421", "0.5556174", "0.5550665", "0.5517502", "0.5478296", "0.5477829", "0.5477583", "0.54640096", "0.5443708", "0.54351574" ]
0.69095236
0
If one of the canvas dimensions is omitted, calculate it and complement it in $this>params Requirement: Needs sourceWidth and sourceHeight to be present, so can only be called after analyzing the image.
private function _addOmittedCanvasDimension() { $sourceWidth = $this->params['sourceWidth']; $sourceHeight = $this->params['sourceHeight']; $sourceRatio = $sourceWidth / $sourceHeight; if ( empty($this->params['w']) && empty($this->params['h']) ) { $this->params['w'] = $sourceWidth; $this->params['h'] = $sourceHeight; } elseif (empty($this->params['h'])) { if ( !$this->params['grow'] && $this->params['w'] > $sourceWidth ) { $this->params['h'] = $sourceHeight; } else { $this->params['h'] = $this->params['w'] / $sourceRatio; } } elseif (empty($this->params['w'])) { if ( !$this->params['grow'] && $this->params['h'] > $sourceHeight ) { $this->params['w'] = $sourceWidth; } else { $this->params['w'] = $this->params['h'] * $sourceRatio; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _getProjectionSize() {\n\t\t$sourceWidth = $this->params['sourceWidth'];\n\t\t$sourceHeight = $this->params['sourceHeight'];\n\t\t$sourceRatio = $sourceWidth / $sourceHeight;\n\n\t\t$canvasWidth = $this->params['w'];\n\t\t$canvasHeight = $this->params['h'];\n\t\t$canvasRatio = $canvasWidth / $canvasHeight;\n\n\n\t\t//\tthe image is not allowed to be cut off in any dimension\n\t\tif ($sourceRatio < $canvasRatio) {\n\t\t\t//\tsource is less landscape-like than canvas\n\t\t\t$leadDimension = !$this->params['crop'] ?\n\t\t\t\t'Height' : 'Width';\n\t\t} else {\n\t\t\t//\tsource is more landscape-like than canvas\n\t\t\t$leadDimension = !$this->params['crop'] ?\n\t\t\t\t'Width' : 'Height';\n\t\t}\n\n\t\tif (\n\t\t\t!$this->params['grow'] &&\n\t\t\t${'source'.$leadDimension} < ${'canvas'.$leadDimension}\n\t\t) {\n\t\t\t${'projection'.$leadDimension} = ${'source'.$leadDimension};\n\t\t} else {\n\t\t\t${'projection'.$leadDimension} = ${'canvas'.$leadDimension};\n\t\t}\n\n\t\tif (isset($projectionWidth)) {\n\t\t\t$projectionHeight = $projectionWidth / $sourceRatio;\n\t\t} elseif (isset($projectionHeight)) {\n\t\t\t$projectionWidth = $projectionHeight * $sourceRatio;\n\t\t}\n\n\t\treturn array(round($projectionWidth), round($projectionHeight));\n\t}", "private function __setOptimalSizeByCrop() {\n \n $heightRatio = $this->__originalImageHeight / $this->__requestedHeight;\n $widthRatio = $this->__originalImageWidth / $this->__requestedWidth;\n \n if ($heightRatio < $widthRatio) {\n $optimalRatio = $heightRatio;\n } else {\n $optimalRatio = $widthRatio;\n }\n \n $this->__optimalHeight = $this->__originalImageHeight / $optimalRatio;\n $this->__optimalWidth = $this->__originalImageWidth / $optimalRatio;\n \n }", "public function CalcWidthHeight()\n {\n list($this->width, $this->height) = $this->imgInfo;\n\n $aspectRatio = $this->width / $this->height;\n\n if($this->cropToFit && $this->newWidth && $this->newHeight) {\n $targetRatio = $this->newWidth / $this->newHeight;\n $this->cropWidth = $targetRatio > $aspectRatio ? $this->width : round($this->height * $targetRatio);\n $this->cropHeight = $targetRatio > $aspectRatio ? round($this->width / $targetRatio) : $this->height;\n if($this->verbose) { self::verbose(\"Crop to fit into box of {$this->newWidth}x{$this->newHeight}. Cropping dimensions: {$this->cropWidth}x{$this->cropHeight}.\"); }\n }\n else if($this->newWidth && !$this->newHeight) {\n $this->newHeight = round($this->newWidth / $aspectRatio);\n if($this->verbose) { self::verbose(\"New width is known {$this->newWidth}, height is calculated to {$this->newHeight}.\"); }\n }\n else if(!$this->newWidth && $this->newHeight) {\n $this->newWidth = round($this->newHeight * $aspectRatio);\n if($this->verbose) { self::verbose(\"New height is known {$this->newHeight}, width is calculated to {$this->newWidth}.\"); }\n }\n else if($this->newWidth && $this->newHeight) {\n $ratioWidth = $this->width / $this->newWidth;\n $ratioHeight = $this->height / $this->newHeight;\n $ratio = ($ratioWidth > $ratioHeight) ? $ratioWidth : $ratioHeight;\n $this->newWidth = round($this->width / $ratio);\n $this->newHeight = round($this->height / $ratio);\n if($this->verbose) { self::verbose(\"New width & height is requested, keeping aspect ratio results in {$this->newWidth}x{$this->newHeight}.\"); }\n }\n else {\n $this->newWidth = $this->width;\n $this->newHeight = $this->height;\n if($this->verbose) { self::verbose(\"Keeping original width & heigth.\"); }\n }\n }", "function image_resize ( $args ) { /*\r\n\t\t * Changelog\r\n\t\t *\r\n\t\t * Version 3, July 20, 2007\r\n\t\t * - Cleaned\r\n\t\t *\r\n\t\t * Version 2, August 12, 2006\r\n\t\t * - Changed it to use $args\r\n\t\t */\r\n\t\t\r\n\t\t// Set default variables\r\n\t\t$image = $width_old = $height_old = $width_new = $height_new = $canvas_width = $canvas_height = $canvas_size = null;\r\n\t\t\r\n\t\t$x_old = $y_old = $x_new = $y_new = 0;\r\n\t\t\r\n\t\t// Exract user\r\n\t\textract($args);\r\n\t\t\r\n\t\t// Read image\r\n\t\t$image = image_read($image,false);\r\n\t\tif ( empty($image) ) { // error\r\n\t\t\ttrigger_error('no image was specified', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Check new dimensions\r\n\t\tif ( empty($width_new) || empty($height_new) ) { // error\r\n\t\t\ttrigger_error('Desired/new dimensions not found', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Do old dimensions\r\n\t\tif ( empty($width_old) && empty($height_old) ) { // Get the old dimensions from the image\r\n\t\t\t$width_old = imagesx($image);\r\n\t\t\t$height_old = imagesy($image);\r\n\t\t}\r\n\t\t\r\n\t\t// Do canvas dimensions\r\n\t\tif ( empty($canvas_width) && empty($canvas_height) ) { // Set default\r\n\t\t\t$canvas_width = $width_new;\r\n\t\t\t$canvas_height = $height_new;\r\n\t\t}\r\n\t\t\r\n\t\t// Let's force integer values\r\n\t\t$width_old = intval($width_old);\r\n\t\t$height_old = intval($height_old);\r\n\t\t$width_new = intval($width_new);\r\n\t\t$height_new = intval($height_new);\r\n\t\t$canvas_width = intval($canvas_width);\r\n\t\t$canvas_height = intval($canvas_height);\r\n\t\t\r\n\t\t// Create the new image\r\n\t\t$image_new = imagecreatetruecolor($canvas_width, $canvas_height);\r\n\t\t\r\n\t\t// Resample the image\r\n\t\t$image_result = imagecopyresampled(\r\n\t\t\t/* the new image */\r\n\t\t\t$image_new,\r\n\t\t\t/* the old image to update */\r\n\t\t\t$image,\r\n\t\t\t/* the new positions */\r\n\t\t\t$x_new, $y_new,\r\n\t\t\t/* the old positions */\r\n\t\t\t$x_old, $y_old,\r\n\t\t\t/* the new dimensions */\r\n\t\t\t$width_new, $height_new,\r\n\t\t\t/* the old dimensions */\r\n\t\t\t$width_old, $height_old);\r\n\t\t\r\n\t\t// Check\r\n\t\tif ( !$image_result ) { // ERROR\r\n\t\t\ttrigger_error('the image failed to resample', E_USER_WARNING);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// return\r\n\t\treturn $image_new;\r\n\t}", "public function setOptimalImageWidthHeight() {\n \n $checkError = $this->isError();\n if (!$checkError) {\n \n if (empty($this->__requestedHeight) || empty($this->__requestedWidth)) {\n $this->setError(__d('cloggy','Empty requested width and height.'));\n } else {\n\n /*\n * get optimal size width and height\n */\n switch ($this->__option) {\n\n case 'exact':\n $this->__optimalWidth = $this->__requestedWidth;\n $this->__optimalHeight = $this->__requestedHeight;\n break;\n\n case 'portrait':\n $this->__setOptimalSizeByPortrait();\n break;\n\n case 'landscape':\n $this->__setOptimalSizeByLandscape();\n break;\n\n case 'crop':\n $this->__setOptimalSizeByCrop();\n break;\n\n default:\n $this->__setOptimalSizeByAuto();\n break;\n }\n }\n \n }\n \n }", "public function _set_new_size_auto()\n {\n if (empty($this->source_width) || empty($this->source_height)) {\n if ( ! $this->SILENT_MODE) {\n trigger_error('Missing source image sizes!', E_USER_WARNING);\n }\n return false;\n }\n $k1 = $this->source_width / $this->limit_x;\n $k2 = $this->source_height / $this->limit_y;\n $k = $k1 >= $k2 ? $k1 : $k2;\n if ($this->reduce_only && $k1 <= 1 && $k2 <= 1) {\n $this->output_width = $this->source_width;\n $this->output_height = $this->source_height;\n } else {\n $this->output_width = round($this->source_width / $k, 0);\n $this->output_height = round($this->source_height / $k, 0);\n }\n return true;\n }", "public function image_reproportion()\n\t{\n\t\tif (($this->width === 0 && $this->height === 0) OR $this->orig_width === 0 OR $this->orig_height === 0\n\t\t\tOR ( ! ctype_digit((string) $this->width) && ! ctype_digit((string) $this->height))\n\t\t\tOR ! ctype_digit((string) $this->orig_width) OR ! ctype_digit((string) $this->orig_height))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Sanitize\n\t\t$this->width = (int) $this->width;\n\t\t$this->height = (int) $this->height;\n\n\t\tif ($this->master_dim !== 'width' && $this->master_dim !== 'height')\n\t\t{\n\t\t\tif ($this->width > 0 && $this->height > 0)\n\t\t\t{\n\t\t\t\t$this->master_dim = ((($this->orig_height/$this->orig_width) - ($this->height/$this->width)) < 0)\n\t\t\t\t\t\t\t? 'width' : 'height';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->master_dim = ($this->height === 0) ? 'width' : 'height';\n\t\t\t}\n\t\t}\n\t\telseif (($this->master_dim === 'width' && $this->width === 0)\n\t\t\tOR ($this->master_dim === 'height' && $this->height === 0))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tif ($this->master_dim === 'width')\n\t\t{\n\t\t\t$this->height = (int) ceil($this->width*$this->orig_height/$this->orig_width);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->width = (int) ceil($this->orig_width*$this->height/$this->orig_height);\n\t\t}\n\t}", "private function setDimensions(){\r\n list($width, $height) = getimagesize($this->fileName);\r\n $this->imageDimensions = array('width'=>$width,\r\n 'height'=>$height);\r\n \r\n }", "protected function resize()\n {\n $width = $this->width;\n $height = $this->height;\n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n // Determine new image dimensions\n if($this->mode === \"crop\"){ // Crop image\n \n $max_width = $crop_width = $width;\n $max_height = $crop_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if($orig_width > $orig_height){ // Original is wide\n $height = $max_height;\n $width = ceil($y_ratio * $orig_width);\n \n } elseif($orig_height > $orig_width){ // Original is tall\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n \n } else { // Original is square\n $this->mode = \"fit\";\n \n return $this->resize();\n }\n \n // Adjust if the crop width is less than the requested width to avoid black lines\n if($width < $crop_width){\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n }\n \n } elseif($this->mode === \"fit\"){ // Fits the image according to aspect ratio to within max height and width\n $max_width = $width;\n $max_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if( ($orig_width <= $max_width) && ($orig_height <= $max_height) ){ // Image is smaller than max height and width so don't resize\n $tn_width = $orig_width;\n $tn_height = $orig_height;\n \n } elseif(($x_ratio * $orig_height) < $max_height){ // Wider rather than taller\n $tn_height = ceil($x_ratio * $orig_height);\n $tn_width = $max_width;\n \n } else { // Taller rather than wider\n $tn_width = ceil($y_ratio * $orig_width);\n $tn_height = $max_height;\n }\n \n $width = $tn_width;\n $height = $tn_height;\n \n } elseif($this->mode === \"fit-x\"){ // Sets the width to the max width and the height according to aspect ratio (will stretch if too small)\n $height = @round($orig_height * $width / $orig_width);\n \n if($orig_height <= $height){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n \n } elseif($this->mode === \"fit-y\"){ // Sets the height to the max height and the width according to aspect ratio (will stretch if too small)\n $width = @round($orig_width * $height / $orig_height);\n \n if($orig_width <= $width){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n } else {\n throw new \\Exception('Invalid mode: ' . $this->mode);\n }\n \n\n // Resize\n $this->temp = imagecreatetruecolor($width, $height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n \n imagecopyresampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);\n $this->sync();\n \n \n // Cropping?\n if($this->mode === \"crop\"){ \n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n $x_mid = $orig_width/2; // horizontal middle\n $y_mid = $orig_height/2; // vertical middle\n \n $this->temp = imagecreatetruecolor($crop_width, $crop_height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n\n imagecopyresampled($this->temp, $this->image, 0, 0, ($x_mid-($crop_width/2)), ($y_mid-($crop_height/2)), $crop_width, $crop_height, $crop_width, $crop_height);\n $this->sync();\n }\n }", "public function create($src, $width = null, $height = null, $no_crop = null, $keep_canvas_size = null, $public = null, $dynamic_output = null) {\n\n if (is_array($src)) {\n\n $src = array_only($src, array('src', 'width', 'w', 'height', 'h', 'no_crop', 'keep_canvas_size', 'dynamic_output'));\n\n if (isset($src['width'])) {\n $width = $src['width'];\n } elseif (isset($src['w'])) {\n $width = $src['w'];\n } else {\n $width = $width;\n }\n\n if (isset($src['height'])) {\n $height = $src['height'];\n } elseif (isset($src['h'])) {\n $height = $src['h'];\n } else {\n $height = $height;\n }\n\n $no_crop = isset($src['no_crop']) ? $src['no_crop'] : $no_crop;\n $keep_canvas_size = isset($src['keep_canvas_size']) ? $src['keep_canvas_size'] : $keep_canvas_size;\n $public = isset($src['public']) ? $src['public'] : $public;\n $dynamic_output = isset($src['dynamic_output']) ? $src['dynamic_output'] : $dynamic_output;\n\n // The following assignment is to be at the last place within this block.\n $src = isset($src['src']) ? $src['src'] : null;\n }\n\n $public = !empty($public);\n $dynamic_output = !empty($dynamic_output);\n\n // Sanitaze the source URL.\n if ($this->_check_path($src) === false) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n // Calcualate the image path from the provided source URL.\n\n $src_path = $this->image_base_path.str_replace($this->image_base_url, '', $src);\n\n if (!is_file($src_path)) {\n\n if ($dynamic_output) {\n $this->_display_error(404);\n }\n\n return false;\n }\n\n $src_path = $this->_get_absolute_filename($src_path);\n\n if ($src_path === false || !is_file($src_path)) {\n\n if ($dynamic_output) {\n $this->_display_error(404);\n }\n\n return false;\n }\n\n // Get the name of a subdirectory that should contain the image's thumbnails.\n $image_cache_subdirectory = $this->_create_path_hash($src_path);\n $image_cache_path = ($public ? $this->image_public_cache_path : $this->image_cache_path).$image_cache_subdirectory.'/';\n\n // Get the image base name and file extension.\n $src_name_parts = $this->ci->image_lib->explode_name($src_path);\n $name = pathinfo($src_name_parts['name'], PATHINFO_BASENAME);\n $ext = $src_name_parts['ext'];\n\n // Expose the image default parameters.\n extract($this->_get_image_defaults());\n\n // Prepare the input parameters.\n\n $w = (string) $width;\n $h = (string) $height;\n\n $no_crop = !empty($no_crop);\n $no_crop_saved = $no_crop;\n\n if ($force_crop) {\n $no_crop = false;\n }\n\n $keep_canvas_size = !empty($keep_canvas_size);\n\n // Determine whether dynamic input is enabled.\n\n if ($dynamic_output) {\n\n $dynamic_output_enabled = false;\n\n foreach ($this->enable_dynamic_output as & $d_location) {\n\n if (strpos($src_path, $d_location) === 0) {\n $dynamic_output_enabled = true;\n }\n }\n\n unset($d_location);\n\n if (!$dynamic_output_enabled) {\n $this->_display_error(403);\n }\n }\n\n // Check whether the image is valid one.\n\n $prop = $this->ci->image_lib->get_image_properties($src_path, true);\n\n if ($prop === false) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $mime_type = $prop['mime_type'];\n $image_type = $prop['image_type'];\n $src_size = filesize($src_path);\n\n // The image seems to be valid, so create the corresponding\n // subdirectory that should contain the image's thumbnails.\n file_exists($image_cache_path) OR @mkdir($image_cache_path, DIR_WRITE_MODE, TRUE);\n\n // Determine whether a watermark should be put.\n\n $has_watermark = false;\n\n foreach ($this->enable_watermark as & $wm_location) {\n\n if (strpos($src_path, $wm_location) === 0) {\n $has_watermark = true;\n }\n }\n\n unset($wm_location);\n\n // Determine kind of Image_lib's resizing operation is to be executed.\n\n $resize_operation = null;\n\n if ($w > 0) {\n\n $resize_operation = 'fit_width';\n $w = (int) $w;\n\n } else {\n\n $w = '';\n }\n\n if ($h > 0) {\n\n $resize_operation = $resize_operation == 'fit_width'\n ? ($no_crop ? ($keep_canvas_size ? 'fit_canvas' : 'fit_inner') : 'fit')\n : 'fit_height';\n\n $h = (int) $h;\n\n } else {\n\n $h = '';\n }\n\n if ($resize_operation == '') {\n\n $w = (int) $prop['width'];\n $h = (int) $prop['height'];\n\n $resize_operation = $keep_canvas_size ? 'fit_canvas' : 'fit_inner';\n }\n\n // Based on the real file name and the relevant parameters the thumbnail's\n // filename (a hash) is to be created. Let us determine these parameters.\n\n $parameters = compact(\n 'src_path',\n 'src_size',\n 'resize_operation',\n 'w',\n 'h',\n 'no_crop',\n 'force_crop',\n 'keep_canvas_size',\n 'has_watermark'\n );\n\n if ($keep_canvas_size) {\n\n $parameters = array_merge($parameters, compact(\n 'bg_r',\n 'bg_g',\n 'bg_b',\n 'bg_alpha'\n ));\n }\n\n if ($has_watermark) {\n\n $wm_parameters = compact(\n 'wm_enabled_min_w',\n 'wm_enabled_min_h',\n 'wm_type',\n 'wm_padding',\n 'wm_vrt_alignment',\n 'wm_hor_alignment',\n 'wm_hor_offset',\n 'wm_vrt_offset'\n );\n\n if ($wm_type == 'text') {\n\n $wm_parameters = array_merge($wm_parameters, compact(\n 'wm_text',\n 'wm_font_path',\n 'wm_font_size',\n 'wm_font_color',\n 'wm_shadow_color',\n 'wm_shadow_distance'\n ));\n\n } elseif ($wm_type == 'overlay') {\n\n $wm_parameters = array_merge($wm_parameters, compact(\n 'wm_overlay_path',\n 'wm_opacity',\n 'wm_x_transp',\n 'wm_y_transp'\n ));\n }\n\n $parameters = array_merge($parameters, $wm_parameters);\n }\n\n // Determine the destination file.\n //$cached_image_name = sha1(serialize($parameters)).$ext;\n $cached_image_name = sha1(serialize($parameters)).'-'.url_title($name, '-', true, true, $this->ci->config->default_language()).$ext; // SEO-friendly, hopefully.\n $cached_image_file = $image_cache_path.$cached_image_name;\n\n // If the destination file does not exist - create it.\n\n if (!is_file($cached_image_file)) {\n\n // Resize the image and write it to destination file.\n\n $config = array();\n $config['source_image'] = $src_path;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['maintain_ratio'] = true;\n $config['create_thumb'] = false;\n $config['width'] = $w;\n $config['height'] = $h;\n $config['quality'] = 100;\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if ($resize_operation == 'fit_inner' || $resize_operation == 'fit_canvas') {\n $this->ci->image_lib->resize();\n } else {\n $this->ci->image_lib->fit();\n }\n\n $this->ci->image_lib->clear();\n\n // If the canvas size is to be preserved - add background with the\n // given width and height and place the image at the center.\n\n if ($resize_operation == 'fit_canvas') {\n\n $backgrund_image = @ tempnam(sys_get_temp_dir(), 'imp');\n\n if ($backgrund_image === false) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $img = imagecreatetruecolor($w, $h);\n imagesavealpha($img, true);\n $bg = imagecolorallocatealpha($img, $bg_r, $bg_g, $bg_b, $bg_alpha);\n imagefill($img, 0, 0, $bg);\n\n $this->ci->image_lib->image_type = $image_type;\n $this->ci->image_lib->full_dst_path = $backgrund_image;\n $this->ci->image_lib->quality = 100;\n\n if (!$this->ci->image_lib->image_save_gd($img)) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $this->ci->image_lib->clear();\n\n $config = array();\n $config['source_image'] = $backgrund_image;\n $config['wm_type'] = 'overlay';\n $config['wm_overlay_path'] = $cached_image_file;\n $config['wm_opacity'] = 100;\n $config['wm_hor_alignment'] = 'center';\n $config['wm_vrt_alignment'] = 'middle';\n $config['wm_x_transp'] = false;\n $config['wm_y_transp'] = false;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['quality'] = 100;\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if (!$this->ci->image_lib->watermark()) {\n\n @ unlink($backgrund_image);\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n @ unlink($backgrund_image);\n $this->ci->image_lib->clear();\n }\n\n // If a watermark is needed, place it.\n\n if ($has_watermark) {\n\n $prop_resized = $this->ci->image_lib->get_image_properties($cached_image_file, true);\n\n if ($prop_resized === false) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if ($prop_resized['width'] < $wm_enabled_min_w || $prop_resized['height'] < $wm_enabled_min_h) {\n $has_watermark = false;\n }\n\n if ($has_watermark) {\n\n $config = array();\n $config['source_image'] = $cached_image_file;\n $config['dynamic_output'] = false;\n $config['new_image'] = $cached_image_file;\n $config['quality'] = 100;\n $config = array_merge($config, $wm_parameters);\n\n if (!$this->ci->image_lib->initialize($config)) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n if (!$this->ci->image_lib->watermark()) {\n\n @ unlink($cached_image_file);\n\n if ($dynamic_output) {\n $this->_display_error(500);\n }\n\n return false;\n }\n\n $this->ci->image_lib->clear();\n }\n }\n }\n\n // Output or return the result.\n\n if ($dynamic_output) {\n $this->_display_graphic_file($cached_image_file, $mime_type, $cached_image_name);\n }\n\n if ($public) {\n\n return array(\n 'path' => $cached_image_file,\n 'url' => $this->image_public_cache_url.$image_cache_subdirectory.'/'.pathinfo($cached_image_file, PATHINFO_BASENAME),\n );\n }\n\n $uri = 'thumbnail';\n\n $url = http_build_url(default_base_url($uri), array(\n 'query' => http_build_query(array(\n 'src' => $src,\n 'w' => $width,\n 'h' => $height,\n 'no_crop' => $no_crop_saved ? 0 : 1,\n 'keep_canvas_size' => $keep_canvas_size ? 0 : 1\n )\n )\n ), HTTP_URL_JOIN_QUERY);\n\n return array(\n 'path' => $cached_image_file,\n 'url' => $url,\n );\n }", "function image_reproportion()\n\t{\n\t\tif ( ! is_numeric($this->dst_width) OR ! is_numeric($this->dst_height) OR $this->dst_width == 0 OR $this->dst_height == 0)\n\t\t\treturn;\n\t\t\n\t\tif ( ! is_numeric($this->src_width) OR ! is_numeric($this->src_height) OR $this->src_width == 0 OR $this->src_height == 0)\n\t\t\treturn;\n\t\n\t\tif (($this->dst_width >= $this->src_width) AND ($this->dst_height >= $this->src_height))\n\t\t{\n\t\t\t$this->dst_width = $this->src_width;\n\t\t\t$this->dst_height = $this->src_height;\n\t\t}\n\t\t\n\t\t$new_width\t= ceil($this->src_width*$this->dst_height/$this->src_height);\t\t\n\t\t$new_height\t= ceil($this->dst_width*$this->src_height/$this->src_width);\n\t\t\n\t\t$ratio = (($this->src_height/$this->src_width) - ($this->dst_height/$this->dst_width));\n\n\t\tif ($this->master_dim != 'width' AND $this->master_dim != 'height')\n\t\t{\n\t\t\t$this->master_dim = ($ratio < 0) ? 'width' : 'height';\n\t\t}\n\t\t\n\t\tif (($this->dst_width != $new_width) AND ($this->dst_height != $new_height))\n\t\t{\n\t\t\tif ($this->master_dim == 'height')\n\t\t\t{\n\t\t\t\t$this->dst_width = $new_width;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->dst_height = $new_height;\n\t\t\t}\n\t\t}\n\t}", "function someImage($width, $height, $options = []);", "protected function _reset()\n {\n $this->_width = null;\n $this->_height = null;\n $this->_imagePath = null;\n\n return parent::_reset();\n }", "function calc_size()\n\t{\n\t\t\t$size = getimagesize(ROOT_PATH . $this->file);\n\t\t\t$this->width = $size[0];\n\t\t\t$this->height = $size[1];\n\t}", "public function __construct()\n {\n if (3 == func_num_args()) {\n $this->width = func_get_arg(0);\n $this->height = func_get_arg(1);\n $this->length = func_get_arg(2);\n }\n }", "public function draw(\\SetaPDF_Core_Canvas $canvas, $x = 0, $y = 0, $width = null, $height = null) {}", "public function draw(\\SetaPDF_Core_Canvas $canvas, $x = 0, $y = 0, $width = null, $height = null) {}", "function crop( $x = 0, $y = 0, $w = 0, $h = 0 )\n\t{\n\t\tif( $w == 0 || $h == 0 )\n\t\t\treturn FALSE;\n\t\t\n\t\t//create a target canvas\n\t\t$new_im = imagecreatetruecolor ( $w, $h );\n\t\n\t\t//copy and resize image to new canvas\n\t\timagecopyresampled( $new_im, $this->im, 0, 0, $x, $y, $w, $h, $w, $h );\n\t\t\n\t\t//delete the old image handle\n\t\timagedestroy( $this->im );\n\t\t\n\t\t//set the new image as the current handle\n\t\t$this->im = $new_im;\n\t}", "protected function _analyzeSourceImage($imageResource, $imageType) {\n\t\t$this->params['sourceWidth'] = imagesx($imageResource);\n\t\t$this->params['sourceHeight'] = imagesy($imageResource);\n\t\t$this->params['mime'] = image_type_to_mime_type($imageType);\n\t\t$this->params['type'] = $imageType;\n\t}", "protected function _generateThumbnail() {\n if ( $this->attributes['width'] == $this->_original_image_info[0] && $this->attributes['height'] == $this->_original_image_info[1] ) {\n $this->_calculated_width = $this->attributes['width'];\n return $this->_calculated_height = $this->attributes['height'];\n }\n if ( $this->attributes['width'] == 0 || $this->attributes['height'] == 0 ) {\n $this->_calculated_width = $this->_original_image_info[0];\n return $this->_calculated_height = $this->_original_image_info[1]; \n }\n //make sure the thumbnail directory exists. \n if ( !is_writable ( $this->thumbs_dir_path ) ) { \n trigger_error ( 'Cannot detect a writable thumbs directory!', E_USER_NOTICE );\n }\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = (int)$this->attributes['width'];\n $this->_calculated_height = (int)$this->attributes['height'];\n return $this->src = $this->_thumb_src; \n }\n // resize image\n $image = new Image();\n $image->open( $this->src, $this->thumb_background_rgb )\n ->resize( (int)$this->attributes['width'], (int)$this->attributes['height'] )\n ->save( $this->_thumb_src, (int)$this->thumb_quality );\n $this->_thumbnail = $image;\n $this->_calculated_width = $this->_thumbnail->getWidth();\n $this->_calculated_height = $this->_thumbnail->getHeight();\n $this->src = $this->_thumb_src;\n }", "protected function _generateThumbnail() {\n if ( $this->attributes['width'] == $this->_original_image_info[0] && $this->attributes['height'] == $this->_original_image_info[1] ) {\n $this->_calculated_width = $this->attributes['width'];\n return $this->_calculated_height = $this->attributes['height'];\n }\n if ( $this->attributes['width'] == 0 || $this->attributes['height'] == 0 ) {\n $this->_calculated_width = $this->_original_image_info[0];\n return $this->_calculated_height = $this->_original_image_info[1]; \n }\n //make sure the thumbnail directory exists. \n if ( !is_writable ( $this->thumbs_dir_path ) ) { \n trigger_error ( 'Cannot detect a writable thumbs directory!', E_USER_NOTICE );\n }\n if ( is_readable ( $this->_thumb_src ) ) {\n $this->_calculated_width = (int)$this->attributes['width'];\n $this->_calculated_height = (int)$this->attributes['height'];\n return $this->src = $this->_thumb_src; \n }\n // resize image\n $image = new Image();\n $image->open( $this->src, $this->thumb_background_rgb )\n ->resize( (int)$this->attributes['width'], (int)$this->attributes['height'] )\n ->save( $this->_thumb_src, (int)$this->thumb_quality );\n $this->_thumbnail = $image;\n $this->_calculated_width = $this->_thumbnail->getWidth();\n $this->_calculated_height = $this->_thumbnail->getHeight();\n $this->src = $this->_thumb_src;\n }", "function _crop_image_resource($img, $x, $y, $w, $h)\n {\n }", "public function setOriginalImageWidthHeight() {\n \n $checkError = $this->isError();\n if (!$checkError) {\n \n /*\n * get original width and height\n */\n $this->__originalImageWidth = imagesx($this->__image);\n $this->__originalImageHeight = imagesy($this->__image);\n \n }\n \n }", "public function __construct($height, $width){\n $this->height = $height;\n $this->width = $width; \n}", "function flexibleCropper($source_location, $desc_location=null,$crop_size_w=null,$crop_size_h=null)\n\t{\n\t list($src_w, $src_h) = getimagesize($source_location);\n\n\t $image_source = imagecreatefromjpeg($source_location);\n\t $image_desc = imagecreatetruecolor($crop_size_w,$crop_size_h);\n\n\t/*\n\t if ($crop_size_w>$crop_size_h) {$my_crop_size_w=null;}\n\t elseif ($crop_size_h>$crop_size_w)\n\t {$my_crop_size_h=null;\n\n\t if (is_null($my_crop_size_h) and !is_null($my_crop_size_w))\n\t { $my_crop_size_h=$src_h*$my_crop_size_w/$src_w; }\n\t elseif (!is_null($my_crop_size_h))\n\t { $my_crop_size_w=$src_w*$my_crop_size_h/$src_h; }\n\t*/\n\n\t if ($src_w<$src_h) {$my_crop_size_h=$src_h*$crop_size_w/$src_w;} else {$my_crop_size_h=$crop_size_h;}\n\t if ($src_h<$src_w) {$my_crop_size_w=$src_w*$crop_size_h/$src_h;} else {$my_crop_size_w=$crop_size_w;}\n\t// echo \"($my_crop_size_w-$my_crop_size_h)\";\n\t if ($my_crop_size_w>$crop_size_w) {$additional_x=round(($crop_size_w-$my_crop_size_w)/2);} else {$additional_x=0;}\n\t if ($my_crop_size_h>$crop_size_h) {$additional_y=round(($crop_size_h-$my_crop_size_h)/2);} else {$additional_y=0;}\n\n\t $off_x=round($src_w/2)-round($my_crop_size_w/2);\n\t $off_y=round($src_h/2)-round($my_crop_size_h/2)+$additional_y;\n\t $off_w=(round($src_w/2)+round($my_crop_size_w/2))-$off_x;\n\t $off_h=(round($src_h/2)+round($my_crop_size_h/2))-$off_y;\n\n\t imagecopyresampled($image_desc, $image_source,$additional_x, $additional_y, $off_x, $off_y, $my_crop_size_w, $my_crop_size_h, $off_w, $off_h);\n\n\t if (!is_null($desc_location))\n\t imagejpeg($image_desc, $desc_location,100);\n\t else\n\t imagejpeg($image_desc);\n\t}", "function cropRatioImage(&$srcImage, $src_width, $src_height, $desiredWidth = 0, $desiredHeight = 0)\n\t{\n\t\t// if only one size is specified\n\t\tif ($desiredWidth == '*' || $desiredHeight == '*')\n\t\t{\n\t\t\t$new_size = $this->calculateSize($src_width, $src_height, $desiredWidth, $desiredHeight);\n\t\t\t$desiredWidth = $new_size['width'];\n\t\t\t$desiredHeight = $new_size['height'];\n\t\t}\n\t\t\n\t\t// get aspect ratio\n\t\t$ratioW = $src_width / $desiredWidth;\n\t\t$ratioH = $src_height / $desiredHeight;\n\t\t\n\t\t$ratio = ($ratioW < $ratioH)?$ratioW:$ratioH;\n\t\t\t\n\t\t// calculate new height and width based on the ratio\n\t\t$new_width = floor($desiredWidth * $ratio);\n\t\t$new_height = floor($desiredHeight * $ratio);\n\t\t\n\t\t// calculate crop start position\n\t\t$startX = floor(($src_width - $new_width) / 2);\n\t\t$startY = floor(($src_height - $new_height) / 2);\n\t\t\n\t\treturn $this->cropImage($srcImage, $startX, $startY, $new_width, $new_height);\n\t}", "function getImageSize() \n { \n return array($this->_width,$this->_height); \n }", "function cropImage($param=array())\r\n {\r\n $ret = array(\r\n 'msg' => false,\r\n 'sts' => false,\r\n );\r\n\r\n $final_size = $param['final_size'];\r\n #$filename = $final_size.'-'.$param['img_newname'];\r\n $filename = $param['img_newname'];\r\n $target_dir = $param['dest_path'];\r\n $target_name = $target_dir.$filename;\r\n $source_name = $param['img_real'];\r\n \r\n //get size from real image \r\n $size = getimagesize($source_name);\r\n $targ_w = $param['w'];\r\n $targ_h = $param['h'];\r\n\r\n //get size from ratio\r\n $final_size = explode(\"x\", $final_size);\r\n $final_w = $final_size[0];\r\n $final_h = $final_size[1];\r\n \r\n if($final_w==='auto' && $final_h==='auto'){ //detect if width and height ratio is \"auto\" then readjust width and height size\r\n $final_w = $targ_w;\r\n $final_h = $targ_h;\r\n }elseif($final_w==='auto'){ //detect if width ratio is \"auto\" then readjust width size\r\n $final_w = intval(($final_size[1] * $targ_w) / $targ_h);\r\n }elseif($final_h==='auto'){ //detect if height ratio is \"auto\" then readjust height size\r\n $final_h = intval(($final_size[0] * $targ_h) / $targ_w);\r\n }\r\n //end\r\n \r\n \r\n $jpeg_quality = 90;\r\n $img_r = imagecreatefromjpeg($source_name);\r\n $dst_r = ImageCreateTrueColor( $final_w, $final_h );\r\n \r\n imagecopyresized(\r\n $dst_r, $img_r, \r\n 0,0, \r\n $param['x'],$param['y'], \r\n $final_w,$final_h,\r\n $param['w'],$param['h']\r\n );\r\n \r\n imagejpeg($dst_r,$target_name,$jpeg_quality);\r\n #$this->send_to_server( array($target_name) );\r\n $url_target_name = str_replace('/data/shopkl/_assets/', 'http://klimg.com/kapanlagi.com/klshop/', $target_name);\r\n \r\n\t\t\t\r\n //find image parent url and dir path from config\r\n //reset($this->imgsize['article']['size']);\r\n //$first_key = key($this->imgsize['article']['size']);\r\n //end find\r\n $ret['sts'] = true;\r\n $ret['filename'] = $filename;\r\n $ret['msg'] = '<div class=\"alert alert-success\">Image is cropped and saved in <a href=\"'. $url_target_name .'?'.date('his').'\" target=\"_blank\">'.$target_name.' !</a></div>';\r\n \r\n return $ret;\r\n }", "protected function _cached_required()\n {\n $image_info = getimagesize($this->source_file);\n\n if (($this->url_params['w'] == $image_info[0]) AND ($this->url_params['h'] == $image_info[1]))\n {\n $this->serve_default = TRUE;\n return FALSE;\n }\n\n return TRUE;\n }", "function imageResize($imageResourceId=null,$width=null,$height=null, $targetWidth=null, $targetHeight=null) {\n\n// $targetWidth =300;\n// $targetHeight =260;\n// dd($imageResourceId,$width,$height, $targetWidth, $targetHeight);\n\n $targetLayer=imagecreatetruecolor($targetWidth,$targetHeight);\n imagecopyresampled($targetLayer,$imageResourceId,0,0,0,0,$targetWidth,$targetHeight, $width,$height );\n// imagecopyresized($targetLayer,$imageResourceId,0,0,0,0, $width,$height,$targetWidth,$targetHeight);\n\n return $targetLayer;\n }" ]
[ "0.5935662", "0.58573115", "0.5662739", "0.55336946", "0.55255026", "0.5448929", "0.538716", "0.53802663", "0.5368557", "0.53425324", "0.533961", "0.52804875", "0.52388597", "0.5222566", "0.5215349", "0.51861775", "0.51854885", "0.51797783", "0.51371247", "0.5130908", "0.5126694", "0.5121297", "0.51174366", "0.5106832", "0.5087795", "0.50560313", "0.50223064", "0.5022158", "0.5003942", "0.49947512" ]
0.74329525
0
Performs the actual projection of the source onto the canvas.
private function _projectSourceOnCanvas(&$source, &$canvas) { $srcX = 0; $srcY = 0; list($projectionWidth, $projectionHeight) = $this->_getProjectionSize(); list($destX, $destY) = $this->_getLeftUpperCoordinateOnCanvas($projectionWidth, $projectionHeight); imagecopyresampled($canvas, $source, $destX, $destY, $srcX, $srcY, $projectionWidth, $projectionHeight, $this->params['sourceWidth'], $this->params['sourceHeight']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function execute()\n {\n $this->_loadProjection();\n $this->_loadShapes();\n $this->_loadSymbols();\n $this->_setWebConfig();\n $this->_setResolution();\n $this->_setUnits();\n $this->_setMapColor();\n $this->_setOutputFormat();\n $this->_setMapExtent();\n $this->_setMapSize();\n $this->_setZoom();\n $this->_setPan();\n $this->_setRotation();\n $this->_setCrop();\n $this->_addLayers();\n $this->addRegions();\n $this->addGraticules();\n $this->addCoordinates();\n $this->_addWatermark();\n $this->_prepareOutput();\n\n return $this;\n }", "public function apply() {\n\t\t$w = $this->getWidth();\n\t\t$h = $this->getHeight();\n\n\t\timagecopyresampled($this->original->getImage(), $this->getImage(), $this->x, $this->y, 0, 0, $w, $h, $w, $h);\n\t}", "public function draw(\\SetaPDF_Core_Canvas $canvas, $x, $y) {}", "public function update()\r\n {\r\n $this->x += $this->dx;\r\n $this->y += $this->dy;\r\n $this->z += $this->dz;\r\n }", "private function _getProjectionSize() {\n\t\t$sourceWidth = $this->params['sourceWidth'];\n\t\t$sourceHeight = $this->params['sourceHeight'];\n\t\t$sourceRatio = $sourceWidth / $sourceHeight;\n\n\t\t$canvasWidth = $this->params['w'];\n\t\t$canvasHeight = $this->params['h'];\n\t\t$canvasRatio = $canvasWidth / $canvasHeight;\n\n\n\t\t//\tthe image is not allowed to be cut off in any dimension\n\t\tif ($sourceRatio < $canvasRatio) {\n\t\t\t//\tsource is less landscape-like than canvas\n\t\t\t$leadDimension = !$this->params['crop'] ?\n\t\t\t\t'Height' : 'Width';\n\t\t} else {\n\t\t\t//\tsource is more landscape-like than canvas\n\t\t\t$leadDimension = !$this->params['crop'] ?\n\t\t\t\t'Width' : 'Height';\n\t\t}\n\n\t\tif (\n\t\t\t!$this->params['grow'] &&\n\t\t\t${'source'.$leadDimension} < ${'canvas'.$leadDimension}\n\t\t) {\n\t\t\t${'projection'.$leadDimension} = ${'source'.$leadDimension};\n\t\t} else {\n\t\t\t${'projection'.$leadDimension} = ${'canvas'.$leadDimension};\n\t\t}\n\n\t\tif (isset($projectionWidth)) {\n\t\t\t$projectionHeight = $projectionWidth / $sourceRatio;\n\t\t} elseif (isset($projectionHeight)) {\n\t\t\t$projectionWidth = $projectionHeight * $sourceRatio;\n\t\t}\n\n\t\treturn array(round($projectionWidth), round($projectionHeight));\n\t}", "private function _reproject($input_projection, $output_projection)\n {\n $this->_setOrigin($output_projection);\n\n $origProjObj = ms_newProjectionObj(self::getProjection($input_projection));\n $newProjObj = ms_newProjectionObj(self::getProjection($output_projection));\n\n $oRect = $this->map_obj->extent;\n $oRect->project($origProjObj, $newProjObj);\n //TODO: failing for http://www.simplemappr.net/map/2962\n $this->map_obj->setExtent($oRect->minx, $oRect->miny, $oRect->maxx, $oRect->maxy);\n $this->map_obj->setProjection(self::getProjection($output_projection));\n }", "function paint()\r\n {\r\n echo \"$this->_canvas.paint();\\n\";\r\n }", "public function draw() {}", "public function draw() {}", "public function render($canvas);", "public function draw();", "public function draw($canvas)\n {\n }", "public function draw($canvas)\n {\n }", "public function setProjection($value)\n {\n $this->_projection = $value;\n return $this;\n }", "protected function _drawRenderingMode(\\SetaPDF_Core_Canvas $canvas) {}", "protected function drawImage():void{\n\t\t$this->imagickDraw = new ImagickDraw;\n\t\t$this->imagickDraw->setStrokeWidth(0);\n\n\t\tfor($y = 0; $y < $this->moduleCount; $y++){\n\t\t\tfor($x = 0; $x < $this->moduleCount; $x++){\n\t\t\t\t$this->setPixel($x, $y);\n\t\t\t}\n\t\t}\n\n\t\t$this->imagick->drawImage($this->imagickDraw);\n\t}", "public function getCanvas() {}", "public function getCanvas() {}", "public function draw()\n {\n //Skip calculations; dummy result after calculating points\n $points = [\n [\"x\" => '0', \"y\" => '0'],\n [\"x\" => '10', \"y\" => '0'],\n [\"x\" => '0', \"y\" => '10'],\n [\"x\" => '10', \"y\" => '10']\n ];\n\n if ($this->format instanceof \\GraphicEditor\\Formats\\Points) {\n $this->format->addPoints($points);\n }\n }", "function _done()\n {\n $this->_getFillStyle();\n $this->_canvas->rectangle(\n \tarray(\n \t\t'x0' => $this->_fillLeft(),\n \t'y0' => $this->_fillTop(),\n \t'x1' => $this->_fillRight(),\n \t'y1' => $this->_fillBottom()\n )\n );\n\n $scaledWidth = $this->_mapSize['X']*$this->_scale;\n $scaledHeight = $this->_mapSize['Y']*$this->_scale;\n\n $this->_canvas->image(\n \tarray(\n \t'x' => $this->_plotLeft,\n \t'y' => $this->_plotTop,\n \t'filename' => $this->_imageMap,\n \t'width' => $scaledWidth,\n \t'height' => $scaledHeight\n )\n );\n\n return Image_Graph_Layout::_done();\n }", "public function getRequest()\n {\n $this->coords = $this->loadParam('coords', array());\n $this->regions = $this->loadParam('regions', array());\n\n $this->output = $this->loadParam('output', 'pnga');\n $this->width = (float)$this->loadParam('width', 900);\n $this->height = (float)$this->loadParam('height', $this->width/2);\n\n $this->image_size = array($this->width, $this->height);\n\n $this->projection = $this->loadParam('projection', 'epsg:4326');\n $this->projection_map = $this->loadParam('projection_map', 'epsg:4326');\n $this->origin = (int)$this->loadParam('origin', false);\n\n $this->bbox_map = $this->loadParam('bbox_map', '-180,-90,180,90');\n\n $this->bbox_rubberband = $this->loadParam('bbox_rubberband', array());\n\n $this->pan = $this->loadParam('pan', false);\n\n $this->layers = $this->loadParam('layers', array());\n\n $this->graticules = (array_key_exists('grid', $this->layers)) ? true : false;\n\n $this->watermark = $this->loadParam('watermark', false);\n\n $this->gridspace = $this->loadParam('gridspace', false);\n\n $this->gridlabel = (int)$this->loadParam('gridlabel', 1);\n\n $this->download = $this->loadParam('download', false);\n\n $this->crop = $this->loadParam('crop', false);\n\n $this->options = $this->loadParam('options', array()); //scalebar, legend, border, linethickness\n\n $this->border_thickness = (float)$this->loadParam('border_thickness', 1.25);\n\n $this->rotation = (int)$this->loadParam('rotation', 0);\n $this->zoom_in = $this->loadParam('zoom_in', false);\n $this->zoom_out = $this->loadParam('zoom_out', false);\n\n $this->_download_factor = (int)$this->loadParam('download_factor', 1);\n\n $this->file_name = $this->loadParam('file_name', time());\n\n $this->download_token = $this->loadParam('download_token', md5(time()));\n setcookie(\"fileDownloadToken\", $this->download_token, time()+3600, \"/\");\n\n return $this;\n }", "public function draw(\\SetaPDF_Core_Canvas $canvas, $x = 0, $y = 0, $width = null, $height = null) {}", "public function draw(\\SetaPDF_Core_Canvas $canvas, $x = 0, $y = 0, $width = null, $height = null) {}", "private function _getLeftUpperCoordinateOnCanvas($projectionWidth, $projectionHeight) {\n\t\t$projectionRatio = $projectionWidth / $projectionHeight;\n\t\t$canvasWidth = $this->params['w'];\n\t\t$canvasHeight = $this->params['h'];\n\t\t$canvasRatio = $canvasWidth / $canvasHeight;\n\n\t\t//\talways center the projection horizontally\n\t\tif ($projectionWidth > $canvasWidth) {\n\t\t\t$x = - (($projectionWidth / 2) - ($this->params['w'] / 2));\n\t\t} else {\n\t\t\t$x = ($this->params['w'] - $projectionWidth) / 2;\n\t\t}\n\n\t\tswitch ($this->params['cropfocus']) {\n\t\t\tcase 'face':\n\t\t\t\t//\tif the image is taller than the canvas, move the starting point halfway up the center\n\t\t\t\tif ($projectionHeight > $canvasHeight) {\n\t\t\t\t\t$y = - ((($projectionHeight / 2) - ($this->params['h'] / 2)) / 2);\n\t\t\t\t} else {\n\t\t\t\t\t$y = ($this->params['h'] - $projectionHeight) / 2;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'center':\n\t\t\tdefault:\n\t\t\t\t//\tcenter the projection vertically\n\t\t\t\tif ($projectionHeight > $canvasHeight) {\n\t\t\t\t\t$y = - (($projectionHeight / 2) - ($this->params['h'] / 2));\n\t\t\t\t} else {\n\t\t\t\t\t$y = ($this->params['h'] - $projectionHeight) / 2;\n\t\t\t\t}\n\t\t}\n\n\t\treturn array($x, $y);\n\t}", "protected function doActualConvert()\n {\n\n $this->logLn('GD Version: ' . gd_info()[\"GD Version\"]);\n\n // Btw: Check out processWebp here:\n // https://github.com/Intervention/image/blob/master/src/Intervention/Image/Gd/Encoder.php\n\n // Create image resource\n $image = $this->createImageResource();\n\n // Try to convert color palette if it is not true color\n $this->tryToMakeTrueColorIfNot($image);\n\n\n if ($this->getMimeTypeOfSource() == 'image/png') {\n // Try to set alpha blending\n $this->trySettingAlphaBlending($image);\n }\n\n // Try to convert it to webp\n $this->tryConverting($image);\n\n // End of story\n imagedestroy($image);\n }", "public function draw()\n {\n echo 'Draw circle';\n }", "abstract public function draw(\\SetaPDF_Core_Canvas $canvas, $x = 0, $y = 0, $width = null, $height = null);", "public static function run($dataDir=null){\r\n $create_options = new BmpOptions();\r\n $create_options->setBitsPerPixel(24);\r\n\r\n # Create an instance of FileCreateSource and assign it to Source property\r\n $fileCreateSource=new FileCreateSource();\r\n $create_options->setSource(new FileCreateSource($dataDir . \"sample.bmp\",false));\r\n\r\n # Create an instance of RasterImage\r\n $image=new Image();\r\n $raster_image = $image->create($create_options,500,500);\r\n\r\n # Get the pixels of the image by specifying the area as image boundary\r\n $pixels = $raster_image->loadPixels($raster_image->getBounds());\r\n\r\n $index = 0;\r\n while ($index < sizeof($pixels)) {\r\n # Set the indexed pixel color to yellow\r\n $color = new Color();\r\n $pixels[$index] = $color->getYellow();\r\n $index += 1;\r\n }\r\n $raster_image->savePixels($raster_image->getBounds(), $pixels);\r\n\r\n # save all changes\r\n $raster_image->save();\r\n\r\n print \"Draw Images Using Core Functionality.\".PHP_EOL;\r\n }", "protected function drawImage():void{\n\t\tfor($y = 0; $y < $this->moduleCount; $y++){\n\t\t\tfor($x = 0; $x < $this->moduleCount; $x++){\n\t\t\t\t$this->setPixel($x, $y);\n\t\t\t}\n\t\t}\n\t}", "public function alejarCamaraPresidencia() {\n\n self::$presidencia->alejarZoom();\n\n }" ]
[ "0.5165557", "0.5083971", "0.48546487", "0.4785309", "0.47584483", "0.47312027", "0.45633852", "0.45289192", "0.45289192", "0.44930074", "0.44896773", "0.43907428", "0.43907428", "0.4387824", "0.43251786", "0.43057728", "0.42746568", "0.42746568", "0.42426994", "0.42317322", "0.42116258", "0.41927707", "0.41905886", "0.41839156", "0.41632164", "0.40930435", "0.4092837", "0.40662783", "0.4065883", "0.40468246" ]
0.70185035
0
Calculate projection size of source image on canvas. The resulting projection might be larger than the canvas; this function does not consider cutoff by means of cropping.
private function _getProjectionSize() { $sourceWidth = $this->params['sourceWidth']; $sourceHeight = $this->params['sourceHeight']; $sourceRatio = $sourceWidth / $sourceHeight; $canvasWidth = $this->params['w']; $canvasHeight = $this->params['h']; $canvasRatio = $canvasWidth / $canvasHeight; // the image is not allowed to be cut off in any dimension if ($sourceRatio < $canvasRatio) { // source is less landscape-like than canvas $leadDimension = !$this->params['crop'] ? 'Height' : 'Width'; } else { // source is more landscape-like than canvas $leadDimension = !$this->params['crop'] ? 'Width' : 'Height'; } if ( !$this->params['grow'] && ${'source'.$leadDimension} < ${'canvas'.$leadDimension} ) { ${'projection'.$leadDimension} = ${'source'.$leadDimension}; } else { ${'projection'.$leadDimension} = ${'canvas'.$leadDimension}; } if (isset($projectionWidth)) { $projectionHeight = $projectionWidth / $sourceRatio; } elseif (isset($projectionHeight)) { $projectionWidth = $projectionHeight * $sourceRatio; } return array(round($projectionWidth), round($projectionHeight)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCropWidth()\n {\n return $this->_daImage->getCropWidth( $this->getId() );\n }", "abstract public function calculateCropBoxSize();", "public function getCropHeight()\n {\n return $this->_daImage->getCropHeight( $this->getId() );\n }", "private function _projectSourceOnCanvas(&$source, &$canvas) {\n\t\t$srcX = 0;\n\t\t$srcY = 0;\n\t\tlist($projectionWidth, $projectionHeight) = $this->_getProjectionSize();\n\t\tlist($destX, $destY) = $this->_getLeftUpperCoordinateOnCanvas($projectionWidth, $projectionHeight);\n\t\timagecopyresampled($canvas, $source, $destX, $destY, $srcX, $srcY, $projectionWidth, $projectionHeight, $this->params['sourceWidth'], $this->params['sourceHeight']);\n\t}", "public function CalcWidthHeight()\n {\n list($this->width, $this->height) = $this->imgInfo;\n\n $aspectRatio = $this->width / $this->height;\n\n if($this->cropToFit && $this->newWidth && $this->newHeight) {\n $targetRatio = $this->newWidth / $this->newHeight;\n $this->cropWidth = $targetRatio > $aspectRatio ? $this->width : round($this->height * $targetRatio);\n $this->cropHeight = $targetRatio > $aspectRatio ? round($this->width / $targetRatio) : $this->height;\n if($this->verbose) { self::verbose(\"Crop to fit into box of {$this->newWidth}x{$this->newHeight}. Cropping dimensions: {$this->cropWidth}x{$this->cropHeight}.\"); }\n }\n else if($this->newWidth && !$this->newHeight) {\n $this->newHeight = round($this->newWidth / $aspectRatio);\n if($this->verbose) { self::verbose(\"New width is known {$this->newWidth}, height is calculated to {$this->newHeight}.\"); }\n }\n else if(!$this->newWidth && $this->newHeight) {\n $this->newWidth = round($this->newHeight * $aspectRatio);\n if($this->verbose) { self::verbose(\"New height is known {$this->newHeight}, width is calculated to {$this->newWidth}.\"); }\n }\n else if($this->newWidth && $this->newHeight) {\n $ratioWidth = $this->width / $this->newWidth;\n $ratioHeight = $this->height / $this->newHeight;\n $ratio = ($ratioWidth > $ratioHeight) ? $ratioWidth : $ratioHeight;\n $this->newWidth = round($this->width / $ratio);\n $this->newHeight = round($this->height / $ratio);\n if($this->verbose) { self::verbose(\"New width & height is requested, keeping aspect ratio results in {$this->newWidth}x{$this->newHeight}.\"); }\n }\n else {\n $this->newWidth = $this->width;\n $this->newHeight = $this->height;\n if($this->verbose) { self::verbose(\"Keeping original width & heigth.\"); }\n }\n }", "public function getImageDimensions()\n {\n $dimension = $this->_getSetting('dimension');\n if ($this->getRow()->use_crop) {\n $parentDimension = $this->_getImageEnlargeComponent()->getImageDimensions();\n $dimension['crop'] = $parentDimension['crop'];\n }\n $data = $this->getImageData();\n return Kwf_Media_Image::calculateScaleDimensions($data['file'], $dimension);\n }", "function image_crop()\n\t{\n\t\t$protocol = 'image_process_'.$this->resize_protocol;\n\t\t\n\t\tif (substr($protocol, -3) == 'gd2')\n\t\t{\n\t\t\t$protocol = 'image_process_gd';\n\t\t}\n\t\t\n\t\treturn $this->$protocol('crop');\n\t}", "public function getPreviewPixelWidth()\n {\n return isset($this->preview_pixel_width) ? $this->preview_pixel_width : null;\n }", "private function _getLeftUpperCoordinateOnCanvas($projectionWidth, $projectionHeight) {\n\t\t$projectionRatio = $projectionWidth / $projectionHeight;\n\t\t$canvasWidth = $this->params['w'];\n\t\t$canvasHeight = $this->params['h'];\n\t\t$canvasRatio = $canvasWidth / $canvasHeight;\n\n\t\t//\talways center the projection horizontally\n\t\tif ($projectionWidth > $canvasWidth) {\n\t\t\t$x = - (($projectionWidth / 2) - ($this->params['w'] / 2));\n\t\t} else {\n\t\t\t$x = ($this->params['w'] - $projectionWidth) / 2;\n\t\t}\n\n\t\tswitch ($this->params['cropfocus']) {\n\t\t\tcase 'face':\n\t\t\t\t//\tif the image is taller than the canvas, move the starting point halfway up the center\n\t\t\t\tif ($projectionHeight > $canvasHeight) {\n\t\t\t\t\t$y = - ((($projectionHeight / 2) - ($this->params['h'] / 2)) / 2);\n\t\t\t\t} else {\n\t\t\t\t\t$y = ($this->params['h'] - $projectionHeight) / 2;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase 'center':\n\t\t\tdefault:\n\t\t\t\t//\tcenter the projection vertically\n\t\t\t\tif ($projectionHeight > $canvasHeight) {\n\t\t\t\t\t$y = - (($projectionHeight / 2) - ($this->params['h'] / 2));\n\t\t\t\t} else {\n\t\t\t\t\t$y = ($this->params['h'] - $projectionHeight) / 2;\n\t\t\t\t}\n\t\t}\n\n\t\treturn array($x, $y);\n\t}", "function image_reproportion()\n\t{\n\t\tif ( ! is_numeric($this->dst_width) OR ! is_numeric($this->dst_height) OR $this->dst_width == 0 OR $this->dst_height == 0)\n\t\t\treturn;\n\t\t\n\t\tif ( ! is_numeric($this->src_width) OR ! is_numeric($this->src_height) OR $this->src_width == 0 OR $this->src_height == 0)\n\t\t\treturn;\n\t\n\t\tif (($this->dst_width >= $this->src_width) AND ($this->dst_height >= $this->src_height))\n\t\t{\n\t\t\t$this->dst_width = $this->src_width;\n\t\t\t$this->dst_height = $this->src_height;\n\t\t}\n\t\t\n\t\t$new_width\t= ceil($this->src_width*$this->dst_height/$this->src_height);\t\t\n\t\t$new_height\t= ceil($this->dst_width*$this->src_height/$this->src_width);\n\t\t\n\t\t$ratio = (($this->src_height/$this->src_width) - ($this->dst_height/$this->dst_width));\n\n\t\tif ($this->master_dim != 'width' AND $this->master_dim != 'height')\n\t\t{\n\t\t\t$this->master_dim = ($ratio < 0) ? 'width' : 'height';\n\t\t}\n\t\t\n\t\tif (($this->dst_width != $new_width) AND ($this->dst_height != $new_height))\n\t\t{\n\t\t\tif ($this->master_dim == 'height')\n\t\t\t{\n\t\t\t\t$this->dst_width = $new_width;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->dst_height = $new_height;\n\t\t\t}\n\t\t}\n\t}", "public function sizeImg($width, $height, $crop = true);", "private function getWorkingImageWidth()\n {\n return imagesx($this->workingImageResource);\n }", "function calc_size()\n\t{\n\t\t\t$size = getimagesize(ROOT_PATH . $this->file);\n\t\t\t$this->width = $size[0];\n\t\t\t$this->height = $size[1];\n\t}", "function cropRatioImage(&$srcImage, $src_width, $src_height, $desiredWidth = 0, $desiredHeight = 0)\n\t{\n\t\t// if only one size is specified\n\t\tif ($desiredWidth == '*' || $desiredHeight == '*')\n\t\t{\n\t\t\t$new_size = $this->calculateSize($src_width, $src_height, $desiredWidth, $desiredHeight);\n\t\t\t$desiredWidth = $new_size['width'];\n\t\t\t$desiredHeight = $new_size['height'];\n\t\t}\n\t\t\n\t\t// get aspect ratio\n\t\t$ratioW = $src_width / $desiredWidth;\n\t\t$ratioH = $src_height / $desiredHeight;\n\t\t\n\t\t$ratio = ($ratioW < $ratioH)?$ratioW:$ratioH;\n\t\t\t\n\t\t// calculate new height and width based on the ratio\n\t\t$new_width = floor($desiredWidth * $ratio);\n\t\t$new_height = floor($desiredHeight * $ratio);\n\t\t\n\t\t// calculate crop start position\n\t\t$startX = floor(($src_width - $new_width) / 2);\n\t\t$startY = floor(($src_height - $new_height) / 2);\n\t\t\n\t\treturn $this->cropImage($srcImage, $startX, $startY, $new_width, $new_height);\n\t}", "public function getPixelWidth()\n {\n return isset($this->pixel_width) ? $this->pixel_width : null;\n }", "public function getWidth()\n\t{\n\t\treturn $this->image->getWidth();\n\t}", "public function crop()\n\t{\n\t\t$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;\n\t\treturn $this->$protocol('crop');\n\t}", "protected function resize()\n {\n $width = $this->width;\n $height = $this->height;\n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n // Determine new image dimensions\n if($this->mode === \"crop\"){ // Crop image\n \n $max_width = $crop_width = $width;\n $max_height = $crop_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if($orig_width > $orig_height){ // Original is wide\n $height = $max_height;\n $width = ceil($y_ratio * $orig_width);\n \n } elseif($orig_height > $orig_width){ // Original is tall\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n \n } else { // Original is square\n $this->mode = \"fit\";\n \n return $this->resize();\n }\n \n // Adjust if the crop width is less than the requested width to avoid black lines\n if($width < $crop_width){\n $width = $max_width;\n $height = ceil($x_ratio * $orig_height);\n }\n \n } elseif($this->mode === \"fit\"){ // Fits the image according to aspect ratio to within max height and width\n $max_width = $width;\n $max_height = $height;\n \n $x_ratio = @($max_width / $orig_width);\n $y_ratio = @($max_height / $orig_height);\n \n if( ($orig_width <= $max_width) && ($orig_height <= $max_height) ){ // Image is smaller than max height and width so don't resize\n $tn_width = $orig_width;\n $tn_height = $orig_height;\n \n } elseif(($x_ratio * $orig_height) < $max_height){ // Wider rather than taller\n $tn_height = ceil($x_ratio * $orig_height);\n $tn_width = $max_width;\n \n } else { // Taller rather than wider\n $tn_width = ceil($y_ratio * $orig_width);\n $tn_height = $max_height;\n }\n \n $width = $tn_width;\n $height = $tn_height;\n \n } elseif($this->mode === \"fit-x\"){ // Sets the width to the max width and the height according to aspect ratio (will stretch if too small)\n $height = @round($orig_height * $width / $orig_width);\n \n if($orig_height <= $height){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n \n } elseif($this->mode === \"fit-y\"){ // Sets the height to the max height and the width according to aspect ratio (will stretch if too small)\n $width = @round($orig_width * $height / $orig_height);\n \n if($orig_width <= $width){ // Don't stretch if smaller\n $width = $orig_width;\n $height = $orig_height;\n }\n } else {\n throw new \\Exception('Invalid mode: ' . $this->mode);\n }\n \n\n // Resize\n $this->temp = imagecreatetruecolor($width, $height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n \n imagecopyresampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);\n $this->sync();\n \n \n // Cropping?\n if($this->mode === \"crop\"){ \n $orig_width = imagesx($this->image);\n $orig_height = imagesy($this->image);\n \n $x_mid = $orig_width/2; // horizontal middle\n $y_mid = $orig_height/2; // vertical middle\n \n $this->temp = imagecreatetruecolor($crop_width, $crop_height);\n \n // Preserve transparency if a png\n if($this->image_info['mime'] == 'image/png'){\n imagealphablending($this->temp, false);\n imagesavealpha($this->temp, true);\n }\n\n imagecopyresampled($this->temp, $this->image, 0, 0, ($x_mid-($crop_width/2)), ($y_mid-($crop_height/2)), $crop_width, $crop_height, $crop_width, $crop_height);\n $this->sync();\n }\n }", "public function getWidth() {\n return imagesx($this->image);\n }", "function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = \\false)\n {\n }", "public function getWidth()\n {\n return imagesx($this->image);\n }", "function resizeCropImage($src, $dst, $dstx, $dsty){\n\t\t//$dst = destination image location\n\t\t//$dstx = user defined width of image\n\t\t//$dsty = user defined height of image\n\t\t$allowedExtensions = 'jpg jpeg gif png';\n\t\t$name = explode(\".\", strtolower($src));\n\t\t$currentExtensions = $name[count($name)-1];\n\t\t$extensions = explode(\" \", $allowedExtensions);\n\n\t\tfor($i=0; count($extensions)>$i; $i=$i+1) {\n\t\t\tif($extensions[$i]==$currentExtensions)\n\t\t\t{ \n\t\t\t\t$extensionOK=1; \n\t\t\t\t$fileExtension=$extensions[$i]; \n\t\t\t\tbreak; \n\t\t\t}\n\t\t}\n\n\t\tif($extensionOK){\n\t\t\t$size = getImageSize($src);\n\t\t\t$width = $size[0];\n\t\t\t$height = $size[1];\n\t\t\tif($width >= $dstx AND $height >= $dsty){\n\t\t\t\t$proportion_X = $width / $dstx;\n\t\t\t\t$proportion_Y = $height / $dsty;\n\t\t\t\tif($proportion_X > $proportion_Y ){\n\t\t\t\t\t$proportion = $proportion_Y;\n\t\t\t\t}else{\n\t\t\t\t\t$proportion = $proportion_X ;\n\t\t\t\t}\n\t\t\t\t$target['width'] = $dstx * $proportion;\n\t\t\t\t$target['height'] = $dsty * $proportion;\n\t\t\t\t$original['diagonal_center'] = round(sqrt(($width*$width)+($height*$height))/2);\n\t\t\t\t$target['diagonal_center'] = round(sqrt(($target['width']*$target['width']) + ($target['height']*$target['height']))/2);\n\t\t\t\t$crop = round($original['diagonal_center'] - $target['diagonal_center']);\n\t\t\t\tif($proportion_X < $proportion_Y ){\n\t\t\t\t\t$target['x'] = 0;\n\t\t\t\t\t$target['y'] = round((($height/2)*$crop)/$target['diagonal_center']);\n\t\t\t\t}else{\n\t\t\t\t\t$target['x'] = round((($width/2)*$crop)/$target['diagonal_center']);\n\t\t\t\t\t$target['y'] = 0;\n\t\t\t\t}\n\t\t\t\tif($fileExtension == \"jpg\" OR $fileExtension=='jpeg'){ \n\t\t\t\t\t$from = ImageCreateFromJpeg($src); \n\t\t\t\t} elseif ($fileExtension == \"gif\"){ \n\t\t\t\t\t$from = ImageCreateFromGIF($src); \n\t\t\t\t} elseif ($fileExtension == 'png'){\n\t\t\t\t\t$from = imageCreateFromPNG($src);\n\t\t\t\t}\n\t\t\t\t$new = ImageCreateTrueColor ($dstx,$dsty);\n\t\t\t\timagecopyresampled ($new, $from, 0, 0, $target['x'], \n\t\t\t\t$target['y'], $dstx, $dsty, $target['width'], $target['height']);\n\t\t\t\tif($fileExtension == \"jpg\" OR $fileExtension == 'jpeg'){ \n\t\t\t\t\timagejpeg($new, $dst, 70); \n\t\t\t\t} elseif ($fileExtension == \"gif\"){ \n\t\t\t\t\timagegif($new, $dst); \n\t\t\t\t}elseif ($fileExtension == 'png'){\n\t\t\t\t\timagepng($new, $dst);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcopy($src, $dst);\n\t\t\t}\n\t\t}\n\t}", "private function __setOptimalSizeByCrop() {\n \n $heightRatio = $this->__originalImageHeight / $this->__requestedHeight;\n $widthRatio = $this->__originalImageWidth / $this->__requestedWidth;\n \n if ($heightRatio < $widthRatio) {\n $optimalRatio = $heightRatio;\n } else {\n $optimalRatio = $widthRatio;\n }\n \n $this->__optimalHeight = $this->__originalImageHeight / $optimalRatio;\n $this->__optimalWidth = $this->__originalImageWidth / $optimalRatio;\n \n }", "public function get_image_width()\n {\n }", "function cropImage($param=array())\r\n {\r\n $ret = array(\r\n 'msg' => false,\r\n 'sts' => false,\r\n );\r\n\r\n $final_size = $param['final_size'];\r\n #$filename = $final_size.'-'.$param['img_newname'];\r\n $filename = $param['img_newname'];\r\n $target_dir = $param['dest_path'];\r\n $target_name = $target_dir.$filename;\r\n $source_name = $param['img_real'];\r\n \r\n //get size from real image \r\n $size = getimagesize($source_name);\r\n $targ_w = $param['w'];\r\n $targ_h = $param['h'];\r\n\r\n //get size from ratio\r\n $final_size = explode(\"x\", $final_size);\r\n $final_w = $final_size[0];\r\n $final_h = $final_size[1];\r\n \r\n if($final_w==='auto' && $final_h==='auto'){ //detect if width and height ratio is \"auto\" then readjust width and height size\r\n $final_w = $targ_w;\r\n $final_h = $targ_h;\r\n }elseif($final_w==='auto'){ //detect if width ratio is \"auto\" then readjust width size\r\n $final_w = intval(($final_size[1] * $targ_w) / $targ_h);\r\n }elseif($final_h==='auto'){ //detect if height ratio is \"auto\" then readjust height size\r\n $final_h = intval(($final_size[0] * $targ_h) / $targ_w);\r\n }\r\n //end\r\n \r\n \r\n $jpeg_quality = 90;\r\n $img_r = imagecreatefromjpeg($source_name);\r\n $dst_r = ImageCreateTrueColor( $final_w, $final_h );\r\n \r\n imagecopyresized(\r\n $dst_r, $img_r, \r\n 0,0, \r\n $param['x'],$param['y'], \r\n $final_w,$final_h,\r\n $param['w'],$param['h']\r\n );\r\n \r\n imagejpeg($dst_r,$target_name,$jpeg_quality);\r\n #$this->send_to_server( array($target_name) );\r\n $url_target_name = str_replace('/data/shopkl/_assets/', 'http://klimg.com/kapanlagi.com/klshop/', $target_name);\r\n \r\n\t\t\t\r\n //find image parent url and dir path from config\r\n //reset($this->imgsize['article']['size']);\r\n //$first_key = key($this->imgsize['article']['size']);\r\n //end find\r\n $ret['sts'] = true;\r\n $ret['filename'] = $filename;\r\n $ret['msg'] = '<div class=\"alert alert-success\">Image is cropped and saved in <a href=\"'. $url_target_name .'?'.date('his').'\" target=\"_blank\">'.$target_name.' !</a></div>';\r\n \r\n return $ret;\r\n }", "function getWidth() {\r\n\t\treturn imagesx($this->image);\r\n\t}", "public static function calculateScaleDimensions($source, $targetSize)\n {\n // Get size of image (handle different param-possibilities)\n if (is_string($source)) {\n $sourceSize = @getimagesize($source);\n } else if ($source instanceof Imagick) {\n $sourceSize = $source->getImageGeometry();\n $source = null;\n } else {\n $sourceSize = $source;\n $source = null;\n }\n\n if (!$sourceSize) return false;\n\n $w = null;\n if (isset($sourceSize[0])) $w = $sourceSize[0];\n if (isset($sourceSize['width'])) $w = $sourceSize['width'];\n\n $h = null;\n if (isset($sourceSize[1])) $h = $sourceSize[1];\n if (isset($sourceSize['height'])) $h = $sourceSize['height'];\n\n if (!$w || !$h) return false;\n\n $originalSize = array($w, $h);\n\n // get output-width\n $outputWidth = 0;\n if (isset($targetSize[0])) $outputWidth = $targetSize[0];\n if (isset($targetSize['width'])) $outputWidth = $targetSize['width'];\n\n // get output-height\n $outputHeight = 0;\n if (isset($targetSize[1])) $outputHeight = $targetSize[1];\n if (isset($targetSize['height'])) $outputHeight = $targetSize['height'];\n\n // get crop-data\n $crop = isset($targetSize['crop']) ? $targetSize['crop'] : null;\n\n // get cover\n $cover = isset($targetSize['cover']) ? $targetSize['cover'] : true;\n\n if ($outputWidth == 0 && $outputHeight == 0) {\n if ($crop) {\n return array(\n 'width' => $crop['width'],\n 'height' => $crop['height'],\n 'rotate' => null,\n 'crop' => array(\n 'x' => $crop['x'],\n 'y' => $crop['y'],\n 'width' => $crop['width'],\n 'height' => $crop['height']\n ),\n );\n } else {\n // Handle keep original\n return array(\n 'width' => $originalSize[0],\n 'height' => $originalSize[1],\n 'rotate' => null,\n 'crop' => array(\n 'x' => 0,\n 'y' => 0,\n 'width' => $originalSize[0],\n 'height' => $originalSize[1]\n ),\n 'keepOriginal' => true,\n );\n }\n }\n\n // Check if image has to be rotated\n $rotate = null;\n if (Kwf_Registry::get('config')->image->autoExifRotate\n && $source\n && function_exists('exif_read_data')\n && isset($sourceSize['mime'])\n && ($sourceSize['mime'] == 'image/jpg'\n || $sourceSize['mime'] == 'image/jpeg')\n ) {\n try {\n $exif = exif_read_data($source);\n if (isset($exif['Orientation'])) {\n switch ($exif['Orientation']) {\n case 6:\n $originalSize = array($h, $w);\n $rotate = 90;\n case 8:\n $originalSize = array($h, $w);\n $rotate = -90;\n }\n }\n } catch (ErrorException $e) {\n $rotate = null;\n }\n }\n\n // Calculate missing dimension\n $calculateWidth = $originalSize[0];\n $calculateHeight = $originalSize[1];\n if ($crop) {\n $calculateWidth = $crop['width'];\n $calculateHeight = $crop['height'];\n }\n\n if ($cover) { // image will always have defined size\n\n if ($outputWidth == 0) {\n if (isset($targetSize['aspectRatio'])) {\n $outputWidth = round($outputHeight * $targetSize['aspectRatio']);\n } else {\n $outputWidth = round($outputHeight * ($calculateWidth / $calculateHeight));\n }\n if ($outputWidth <= 0) $outputWidth = 1;\n }\n if ($outputHeight == 0) {\n if (isset($targetSize['aspectRatio']) && $targetSize['aspectRatio']) {\n $outputHeight = round($outputWidth * $targetSize['aspectRatio']);\n } else {\n $outputHeight = round($outputWidth * ($calculateHeight / $calculateWidth));\n }\n if ($outputHeight <= 0) $outputHeight = 1;\n }\n if (!$crop) { // crop from complete image\n $crop = array();\n // calculate crop depending on target-size\n if (($outputWidth / $outputHeight) >= ($originalSize[0] / $originalSize[1])) {\n $crop['width'] = $originalSize[0];\n $crop['height'] = $originalSize[0] * ($outputHeight / $outputWidth);\n } else {\n $crop['height'] = $originalSize[1];\n $crop['width'] = $originalSize[1] * ($outputWidth / $outputHeight);\n }\n // calculate x and y of crop\n $xDiff = $originalSize[0] - $crop['width'];\n $crop['x'] = $xDiff > 0 ? $xDiff / 2 : 0;\n $yDiff = $originalSize[1] - $crop['height'];\n $crop['y'] = $yDiff > 0 ? $yDiff / 2 : 0;\n } else {\n $oldCrop['width'] = $crop['width'];\n $oldCrop['height'] = $crop['height'];\n if (($outputWidth / $outputHeight) >= ($crop['width'] / $crop['height'])) {\n $crop['width'] = $crop['width'];\n $crop['height'] = $crop['width'] * ($outputHeight / $outputWidth);\n } else {\n $crop['height'] = $crop['height'];\n $crop['width'] = $crop['height'] * ($outputWidth / $outputHeight);\n }\n $xDiff = $oldCrop['width'] - $crop['width'];\n $crop['x'] += $xDiff > 0 ? $xDiff / 2 : 0;\n $yDiff = $oldCrop['height'] - $crop['height'];\n $crop['y'] += $yDiff > 0 ? $yDiff / 2 : 0;\n }\n\n } elseif (!$cover) { // image keeps aspectratio and will not be scaled up\n\n // calculateWidth is cropWidth if existing else originalWidth.\n // prevent image scale up\n if (!$crop) {\n $crop = array(\n 'x' => 0,\n 'y' => 0,\n 'width' => $originalSize[0],\n 'height' => $originalSize[1]\n );\n }\n if ($calculateWidth <= $outputWidth && $calculateHeight <= $outputHeight) {\n $outputWidth = $calculateWidth;\n $outputHeight = $calculateHeight;\n } else {\n if ($calculateWidth < $outputWidth) {\n $outputWidth = $calculateWidth;\n }\n if ($calculateHeight < $outputHeight) {\n $outputHeight = $calculateHeight;\n }\n }\n $widthRatio = $outputWidth ? $calculateWidth / $outputWidth : null;\n $heightRatio = $outputHeight ? $calculateHeight / $outputHeight : null;\n if ($widthRatio > $heightRatio) {\n $outputWidth = $calculateWidth / $widthRatio;\n $outputHeight = $calculateHeight / $widthRatio;\n } else if ($heightRatio > $widthRatio) {\n $outputWidth = $calculateWidth / $heightRatio;\n $outputHeight = $calculateHeight / $heightRatio;\n }\n\n }\n\n $outputWidth = round($outputWidth);\n if ($outputWidth <= 0) $outputWidth = 1;\n $outputHeight = round($outputHeight);\n if ($outputHeight <= 0) $outputHeight = 1;\n\n $ret = array(\n 'width' => round($outputWidth),\n 'height' => round($outputHeight),\n 'rotate' => $rotate,\n 'crop' => $crop\n );\n\n //Set values to match original-parameters when original won't change\n if ($ret['crop']['x'] == 0\n && $ret['crop']['y'] == 0\n && $ret['crop']['width'] == $originalSize[0]\n && $ret['crop']['height'] == $originalSize[1]\n && $ret['width'] == $originalSize[0]\n && $ret['height'] == $originalSize[1]\n ) {\n $ret['rotate'] = null;\n $ret['keepOriginal'] = true;\n }\n\n return $ret;\n }", "abstract public function calculateCropBoxCoordinates();", "public function getImageWidth()\n {\n return $this->imageWidth;\n }", "function _image_get_preview_ratio($w, $h)\n {\n }" ]
[ "0.57293326", "0.5340515", "0.52046746", "0.5099397", "0.5029074", "0.4978582", "0.4871412", "0.4766708", "0.4755078", "0.47048938", "0.46771646", "0.46687528", "0.46630624", "0.4653845", "0.46502748", "0.46243185", "0.46205023", "0.45872632", "0.45673963", "0.45664427", "0.45538938", "0.45272222", "0.45248044", "0.450332", "0.4472308", "0.4471775", "0.44716612", "0.44703448", "0.44572333", "0.44243103" ]
0.7326923
0
/Paso 1: Se analiza la variable $param. si es un entero suponemos que es el id del blog. si es una cadena suponemos que es el nombre del blog,por lo que obtendremos el blog a partir de su nombre. Se obtiene el id del blog
private function getBlogFromParam($param){ // P 1 if (is_numeric($param) ){ $blog_id=$param; $blogs= $this->getDoctrine()->getEntityManager() ->createQuery('SELECT b FROM AcmeBlogBundle:Blog b WHERE b.blog_id=:blog_id') ->setParameter('blog_id', $blog_id) ->getResult(); }else if ( is_string($param) && !empty($param) ){ $blog_name=$param; $blogs= $this->getDoctrine()->getEntityManager() ->createQuery('SELECT b FROM AcmeBlogBundle:Blog b WHERE b.blog_name=:blog') ->setParameter('blog', $blog_name) ->getResult(); } $blog=$blogs[0]; return $blog; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_blog_post($blog_id, $post_id)\n {\n }", "public function for_blog($blog_id = '')\n {\n }", "public function article()\n\t{\n//\t\t$this->load->database();\n//\t\t$this->load->library(\"vendor/FluentPDO/FluentPDO\", array(\"pdo\"=>$this->db->conn_id));\n//\t\t//$query = $this->fluentpdo->from('M_admin')->where('admin_id = ?', 'admin')->getQuery();\n//\t\t$statement = $this->fluentpdo->from('M_admin')->where(array(\"admin_id LIKE\" => \"%dmin%\"))->order(\"admin_id desc\");\n//\n//\t\t$param = $statement->getParameters();\n//\t\t$sql = $statement->getQuery();\n//\t\techo $sql;\n//\t\tprint_r($param);\n//\t\t$res = $this->db->query($sql, $param)->result();\n//\t\tprint_r($res);\n//\t\t//foreach($query as $row) {\n\t\t\t//print_r($row);\n\t\t//}\n//phpinfo();\nprint_r($_REQUEST);\n $this->load->model(\"Blog_Model\");\n\t\t$res = $this->Blog_Model->getById(2);\n\n $in = array();\n $in[\"blog_id\"] = 1;\n $res = $this->Blog_Model->get($in);\n print_r($res);\n\n\t\t$this->load->view('welcome_message');\n\t}", "function blog($id){\n\t\tglobal $bdd;\n\n\t\t$req = $bdd->prepare(\"SELECT fqdn_blog FROM utilisateur WHERE id_utilisateur = :id\");\n\t\t$req->execute(array(\"id\"=>$id));\n\n\t\twhile($results = $req->fetch()){\n\t\t\t$result = $results[\"fqdn_blog\"];\n\t\t}\n\n\t\treturn $result;\n\t}", "public function get_edit_blog($blog_id = \"\", $title_url = \"\")\n\t{\t\t\t\t \t\t\t\t\t\t\t\n\t\t$result = $this->db->from(\"blog\")\n\t\t\t\t\t->join(\"category\",\"category.category_id\",\"blog.category_id\")\t\t\t\t\t\t\n\t\t\t\t\t->where(array(\"blog_id\" => $blog_id, \"url_title\" => $title_url))\n\t\t\t\t\t->get();\n\t\treturn $result;\n\t}", "function get_id_from_blogname($slug)\n {\n }", "public function showBlog($id){\n\t\t$sql = \"SELECT * FROM blogs where id = :id\";\n\t\t\n\t\t$u = $this->dbcon->prepare($sql);\n\t\t$u->bindParam(':id', $id);\n\t\t$u->execute();\n\t\t$blog = $u->fetch(PDO::FETCH_OBJ);\n\t\treturn $blog;\n\n\t}", "public function blogAction()\n {\n\n \t$blogId = $this->_request->getParam(2);\n $page = $this->_request->getParam(3);\n\n $blog = Data::factory($blogId, Blog::ITEM_TYPE);\n\t\tif(empty($blog)){\n throw new Lib_Exception_NotFound(\"Blog '$blogId' not found\");\n }\n\n Zend_Registry::set('Category', $blog->getCategory());\n Zend_Registry::set('SubCategory', $blog->getSubCategory());\n\n $table = new Blog_Post();\n $select = $table->select();\n $select->where(\"blogId = $blog->id\");\n\n // Regular users only see valid posts\n if(!$blog->isEditableBy($this->_user, $this->_acl)){\n \t$select->where(\"status = '\".Data::VALID.\"'\");\n }\n $select->order(\"date DESC\");\n\n $posts = $this->_helper->dataPaginator($select, $page, 'commonviews/pagination.phtml', BLOGPOSTS_PER_PAGE);\n\n $this->view->blog = $blog;\n $this->view->dataType = 'Blog_Post';\n $this->view->posts = $posts;\n \n if($this->_user->getId() == $blog->getSubmitter()->getId()){\n \t$this->_useAdditionalContent = false;\n \t$this->_helper->layout->setLayout('one-column');\n } else {\n \t$this->_useAdditionalContent = true;\n \t$this->_helper->layout->setLayout('two-columns');\n \t$this->view->wrapperIsCard = true;\n }\n \n \n }", "function edit($rqst, $param)\n {\n \\App::go('login');\n\n //Checando se a rota está correta\n if (!isset($param['id'])) {\n \\App::go($this->blogLink);\n }\n\n //USER\n $user = User::this();\n\n //$user->getMe();\n $user->getById(7);\n $aID = $param['id'] == 'new'\n || (is_numeric($param['id'])\n && $param['id'] == 0)\n ? 0\n : $param['id'];\n \n $page = $aID == 0 ? 'new' : 'edit';\n\n $article = new Model\\Article($aID);\n $base = new Model\\Base;\n\n $aID = $article->get('id') + 0;\n\n //Se não existir, cria um novo artigo.\n $data['blogName'] = $this->blogName;\n $data['authorName'] = $user->get('name');\n $data['authorFoto'] = _URL.'media/user/'.$user->get('id').'/1.jpg';\n $data['authorLink'] = _URL.'perfil'; //'user/'.$user->get('login');\n $data['authorPubData'] = date(\"d/m/Y à\\s H:i\", strtotime($article->get('pubdate')));\n $data['articleTitle'] = $article->get('title');\n $data['articleResume'] = $article->get('resume');\n $data['articleContent'] = $article->get('content');\n $data['articleLink'] = $article->get('link');\n $data['articleViewLink'] = $this->blogArticleLink.$article->get('link');\n\n //Select CATEGORIES\n $data['categoria']['data'] = $base->getCategories();\n $data['categoria']['default'] = $article->get('category');\n\n //Select STATUS\n $data['status']['data'] = $base->getStatus();\n $data['status']['default'] = $article->get('status');\n\n //Tags\n $data['articleTags'] = $article->get('tags');\n\n //$this->styles = ['source/font-awesome.min'];\n $this->scripts = ['blog/2'];\n\n //Send page to user\n $this->sendPage('page_'.$page, $data, ['aType'=>$page, 'aID'=>$aID, 'uID'=>$user->get('id'), 'pageLink'=>$article->get('link')]);\n }", "function get_current_blog_id()\n {\n }", "public function buscar($param){\n $where = \" true \";\n /*if ($param<>NULL){\n if (isset($param['id']))\n $where.=\" and id =\".$param['id'];\n if (isset($param['descrip']))\n $where.=\" and descrip ='\".$param['descrip'].\"'\";\n }*/\n $arreglo = Menu::listar($where); \n return $arreglo;\n \n \n \n \n }", "function refresh_blog_details($blog_id = 0)\n {\n }", "function add_blog($id,$blog,$status){\n\t\tglobal $bdd;\n\n\t\t$req = $bdd->query(\"UPDATE `utilisateur` SET `fqdn_blog` = '$blog' WHERE `id_utilisateur` = $id\");\n\t\t$req = $bdd->query(\"UPDATE `utilisateur` SET `status_blog` = '$status' WHERE `id_utilisateur` = $id\");\n\t\t\n\t\t$req->closeCursor();\n\t}", "function selectBlog($shortname) {\n global $blogid, $archivelist;\n $blogid = intval($blogid);\n if (!($blogid > 0)) {\n $blogid = getBlogIDFromName($shortname);\n }\n\n // also force archivelist variable, if it is set\n if ($archivelist) {\n $archivelist = $blogid;\n }\n}", "function SingleBlog(){\n\t\t$query = \"SELECT id, title, content, readperm, commentperm, date, category FROM blog_content WHERE id='\".$this->bid.\"' AND uid='\".$this->id.\"'\";\n\t\t$result = mysqli_query($conn, $query);\n\t\t$result = mysqli_query($conn, $query);\n\t\t$total_entries = mysqli_num_rows($result);\n\t\tif($total_entries == 0){\n\t\t\techo \"<div class='side-body-bg'>\\n\";\n\t\t\techo \"<span class='scapmain'>Error: No Blog postings found.</span>\\n\";\n\t\t\techo \"</div>\\n\";\n\t\t}\n\t\telse {\n\t\t\t$row = mysqli_fetch_array($result);\n\t\t\t$subline = \"Posted by \".$this->uname.\" on mm/dd/yyyy\";\n\t\t\techo \"<div class='side-body-bg'>\\n\";\n\t\t\techo \"<span class='scapmain'><a href='/blogs/\".$this->uname.\"/\".$row['id'].\"-\".stripslashes(CleanFileName($row['title'])).\"/'>\".stripslashes($row['title']).\"</a></span>\\n\";\n\t\t\techo \"<br />\\n\";\n\t\t\techo \"<span class='poster'>$subline</span>\\n\";\n\t\t\techo \"</div>\\n\";\n\t\t\techo \"<div class='tbl'>\".$row['content'].\"</div>\\n\";\n\t\t\techo \"<br />\\n\";\n\t\t}\n\t}", "public function findPost($id, $sanitize, $author = null)\n{\n \n $idsanitized = $this->filteringId($sanitize, $id, 'sql');\n \n if (!empty($author)) {\n \n $sql = \"SELECT ID, \n media_id, \n post_author,\n \t \t\t post_date, \n post_modified, \n post_title,\n \t \t\t post_slug, \n post_content, \n post_summary, \n post_keyword, \n post_tags,\n post_status,\n \t \t\t post_type, \n comment_status\n \t \t\t FROM tbl_posts\n \t \t\t WHERE ID = :ID AND post_author = :author\n \t\t\t AND post_type = 'blog'\";\n \n $data = array(':ID' => $idsanitized, ':author' => $author);\n \n } else {\n \n $sql = \"SELECT ID, \n media_id, \n post_author,\n \t \t\t post_date, \n post_modified, \n post_title,\n \t \t\t post_slug, \n post_content, \n post_summary, \n post_keyword, \n post_tags,\n post_status,\n \t \t\t post_type, \n comment_status\n \t \t\t FROM tbl_posts\n \t \t\t WHERE ID = :ID AND post_type = 'blog'\";\n \n $data = array(':ID' => $idsanitized);\n \n }\n \n $this->setSQL($sql);\n \n $postDetail = $this->findRow($data);\n\n return (empty($postDetail)) ?: $postDetail;\n \n}", "public function updateBlogbyId($id , $title , $desc , $author){\r\n\r\n $query = 'UPDATE `blog_tbl` SET `title`=:title,`description`=:description,`updated_at`=:updated_at,`author`=:author WHERE id = :id';\r\n\r\n $stmt = $this->_db->prepare($query);\r\n\r\n $update = date(\"Y-m-d h:i:s\");\r\n\r\n $stmt->bindParam(':title',$title);\r\n\r\n $stmt->bindParam(':description',$desc);\r\n\r\n $stmt->bindParam(':updated_at',$update);\r\n\r\n $stmt->bindParam(':author',$author);\r\n\r\n $stmt->bindParam(':id',$id);\r\n\r\n $stmt->execute();\r\n\r\n header(\"Location:index.php\");\r\n }", "public function column_id($blog)\n {\n }", "function blog($pid)\n{\n\n\t$pname=mysql_fetch_array(mysql_query(\"select blog from manage_property where pid='$pid'\"));\n\t return $pname['blog'];\n}", "function getAuthor($param) {\n global $author;\n $author = \"\";\n $authorCount = 1;\n for($i = 0; $i < strlen('$str'); $i++) {\n if($str[$i] != \":\" && $authorCount == $param && $activeAuthor) {\n $author .= $str[$i];\n $author = \"Charlie\";\n } else if($str[$i] == \":\") {\n $authorCount++;\n $activeAuthor = false;\n $activeMsg = true;\n } else if($str[$i] == \"*\") {\n $activeAuthor = true;\n $activeMsg = false;\n }\n }\n }", "function giveSpecificPost($postURL) {\n //$postURL gotten from http://miguelamigotgonzalez.com/blog.php?post=[$postURL]\n $postTitle = urldecode($postURL);\n global $DBH;\n $STH = $DBH->prepare('SELECT id, title, date, description, post FROM blogPosts WHERE title = :passTitle');\n $STH->bindParam(':passTitle', $postTitle);\n $STH->execute();\n $result = $STH->fetchAll();\n \n foreach($result as $newEntry) {\n //Save information to an array\n $id = $newEntry[id];\n $title = $newEntry[title];\n $date = $newEntry[date];\n $desc = $newEntry[description];\n $post = $newEntry[post];\n }\n \n //Variables above contain the information of the last blogpost\n $output = formatPost($id, $title, $date, $desc, $post);\n return $output;\n}", "public function getPost($param);", "public function blogpostActionGet($slug) : object\n {\n $page = $this->app->page;\n $title = \"BlogPost: ${slug}\";\n $db = $this->app->db;\n $filter = new MyTextFilter();\n\n $db->connect();\n $sql = <<<EOD\nSELECT\n *,\n DATE_FORMAT(COALESCE(updated, published), '%Y-%m-%dT%TZ') AS published_iso8601,\n DATE_FORMAT(COALESCE(updated, published), '%Y-%m-%d') AS published\nFROM content\nWHERE \n slug = ?\n AND type = ?\n AND (deleted IS NULL OR deleted > NOW())\n AND published <= NOW()\nORDER BY published DESC\n;\nEOD;\n $content = $db->executeFetch($sql, [$slug, \"post\"]);\n if (!($content)) {\n $page->add(\"cms/404\");\n } elseif ($content->filter) {\n $text = $content->data;\n $filters = explode(\",\", $content->filter);\n $filteredText = $filter->parse($text, $filters);\n $content->data = $filteredText;\n }\n $page->add(\"cms/blogpost\", [\n \"content\" => $content\n ]);\n return $page->render([\n \"title\" => $title\n ]);\n }", "function choose_primary_blog()\n {\n }", "function get_post_id($slug = '', $display = true) {\n\tif($slug == '') { $slug = $_GET['page']; }\n\t\n\tinclude('connect.php');\t\t\n\t\n\t$get = $db->prepare('SELECT id FROM posts WHERE slug = :slug');\n\t$get->execute(array(':slug' => $slug));\n\t\n\t$return = $get->fetch(PDO::FETCH_OBJ);\t\t\n\t\n\tif($display) echo $return->id;\n\treturn $return->id;\n}", "function get_blog_by_title($db, $title)\n\t{\n\t\tif(is_string($title))\n\t\t{\n\t\t\t$sql = sprintf(\"SELECT * FROM articles WHERE title LIKE '%s'\", \n\t\t\t\t\t\t\t\tmysqli_real_escape_string($db, $title));\n\n\t\t\t$result = mysqli_query($db, $sql);\n\n\t\t\tif(!$result || mysqli_num_rows($result) === 0)\n\t\t\t\treturn NULL;\n\n\t\t\treturn $result;\n\t\t}\n\t\telse\n\t\t\tthrow new Exception(\"String parameter required.\");\n\t}", "public function switch_to_blog($blog_id)\n {\n }", "public function getParam($param);", "public function detail($slug){\n $data['obj_category_videos'] = $this->nav_videos();\n \n //get data catalog\n $params_categogory_id = array(\n \"select\" =>\"category_id,name\",\n \"where\" => \"slug like '%$slug%' and category.type = 2\");\n $obj_category = $this->obj_category->get_search_row($params_categogory_id);\n $category_id = $obj_category->category_id;\n \n $url = explode(\"/\",uri_string());\n $slug_2 = $url[2];\n \n //GET DATA BLOG \n $params = array(\"select\" =>\"blog.title,\n blog.date,\n blog.slug,\n blog.img,\n blog.img_2,\n blog.date,\n blog.content,\n category.name as category_name,\n category.slug as category_slug,\n blog.blog_id\",\n \"where\" => \"blog.slug = '$slug_2' and blog.category_id = $category_id and blog.active = 1 and blog.status_value = 1\",\n \"join\" => array('category, blog.category_id = category.category_id'),\n \"order\" => \"blog.blog_id DESC\",);\n $data['obj_blog'] = $this->obj_blog->get_search_row($params);\n //SEND DATA META OG FACEBOOK\n $data['meta_title_blog'] = $data['obj_blog']->title;\n $data['meta_description_blog'] = \"Aprende todo lo que necesitas saber acerca del mundo financiero y las criptomonedas. Visita nuestro blog y entérate al respecto.\";\n $data['meta_img_blog'] = site_url().\"static/cms/img/blog/\".$data['obj_blog']->img;\n $title_blog = $data['obj_blog']->title;\n \n \n //get rand blog\n $params = array(\n \"select\" =>\"blog.title,\n blog.date,\n blog.slug,\n blog.img,\n blog.date,\n blog.content,\n category.name as category_name,\n category.slug as category_slug,\n blog.blog_id\",\n \"where\" => \"blog.category_id = $category_id and blog.active = 1 and blog.status_value = 1\",\n \"join\" => array('category, blog.category_id = category.category_id'),\n \"order\" => \"rand()\",\n \"limit\" => \"6\");\n $data['obj_blog_rand'] = $this->obj_blog->search($params);\n \n //SEND DATA TITLE\n $data['title'] = \"Blog | \". $obj_category->name.\" | \".$title_blog;\n $this->load->view('blog_detail',$data);\n\t}", "function get_users_of_blog($id = '')\n {\n }" ]
[ "0.64192086", "0.6385089", "0.6243699", "0.61947244", "0.6075175", "0.606344", "0.6032463", "0.6031012", "0.59944624", "0.5955123", "0.5897971", "0.5868819", "0.5804248", "0.5778227", "0.57528985", "0.5746672", "0.5736558", "0.57284915", "0.57063586", "0.570587", "0.5699835", "0.56590414", "0.560766", "0.56045514", "0.5594849", "0.5587064", "0.5568773", "0.55654955", "0.55566883", "0.5548251" ]
0.81319106
0
Saves new password after match validation
public function savepasswordAction(){ $request = $this->_request->getParams(); $error = false; $oValidationHelper = new Helpers_Usermanagement_Validate(); if(!$oValidationHelper->ifPasswordMatch($request['user_password'],$request['password2'])){ $error = true; $this->_messages->setMessage('Passwords entered do not match','error','user_password'); } if($this->_validator->validate('passreset_form',$request) && !$error){ $this->_auth->user_password = md5($request['user_password']); $this->_auth->save(); $this->_messages->setMessage('Password has been updated'); $this->_redirect('/usermanagement/profile/passwordform'); }else{ foreach ( $this->_validator->getErrors () as $field=>$error ) { $this->_messages->setMessage ( $error, 'error' , $field); } $this->_redirect('/usermanagement/profile/passwordform/?error=1'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setPassword($newPassword);", "function savePassword()\n {\n // get real current password from database\n $realPassword = null;\n $dataReturn = $this->model->khachhang->getCustomerPassword($_SESSION['idUser']);\n if (!empty($dataReturn)) {\n $realPassword = $dataReturn['matKhau'];\n }\n // data user enter in form change password\n $currentPasswordText = isset($_POST['customer_password_current']) ? $_POST['customer_password_current'] : '';\n // kiem tra mat khau hien tai nhap vao co giong voi mat khau trong CSDL la $realPassword hay khong ?\n if (!password_verify(addslashes($currentPasswordText . $_SESSION['email']), $realPassword)) {\n // neu khong trung khop\n $_SESSION['error-changePassCustomer'] = 'Mật khẩu hiện tại không đúng !';\n redirect('user/changePassword');\n } else {\n $newPasswordText = isset($_POST['customer_password_new']) ? $_POST['customer_password_new'] : '';\n $resultUpdate = $this->model->khachhang->updateCustomerPassword($_SESSION['idUser'], $newPasswordText);\n if ($resultUpdate) {\n // neu luu mat khau moi thanh cong\n $_SESSION['success-changePassCustomer'] = 'Đổi mật khẩu mới thành công !';\n redirect('user/index');\n } else {\n\n }\n }\n }", "protected function changePassword() {}", "public function saveAdmPassword(){\n $this->Utilisateur->id = 1;\n if ($this->Utilisateur->saveField('password', $this->data['Utilisateur']['password_new'])):\n $this->Session->setFlash(__('Mot de passe administrateur mis à jour',true),'flash_success');\n else:\n $this->Session->setFlash(__('Mot de passe administrateur <b>NON</b> mis à jour',true),'flash_failure'); \n endif;\n $this->History->goBack(1);\n }", "public function testUpdatePasswordsDontMatch(): void { }", "public function testUpdatePasswordNotGiven(): void { }", "function save() {\r\n if(strlen($this->password) != 40) {\r\n $this->password = sha1($this->password);\r\n }\r\n // Call the parent save() method.\r\n return parent::save();\r\n }", "public function saveNewPass()\n {\n $emailNeedChangePass = isset($_SESSION['email_need_change_pass']) ? $_SESSION['email_need_change_pass'] : '';\n $newPassword = isset($_POST['f-newpass']) ? $_POST['f-newpass'] : '';\n if (($emailNeedChangePass != null) && ($newPassword != null)) {\n $resutl = $this->model->khachhang->saveNewPassword($emailNeedChangePass, $newPassword);\n if ($resutl == true) {\n $_SESSION['forget-changepass-success'] = \"Đổi mật khẩu mới thành công !\";\n unset($_SESSION['email_need_change_pass']);\n } else {\n $_SESSION['forget-changepass-fail'] = \"Đổi mật khẩu mới thất bại !\";\n }\n redirect('user/enterNewPass');\n }\n }", "public function setPassword($newPassword){\n\t}", "public function setNewPassword()\n {\n PasswordResetModel::setNewPassword(\n Request::post('user_name'), Request::post('user_password_reset_hash'),\n Request::post('user_password_new'), Request::post('user_password_repeat')\n );\n Redirect::to('index');\n }", "protected function afterValidate()\n {\n \tparent::afterValidate();\n \tif(!$this->hasErrors())\n \t\t$this->password = $this->hashPassword($this->password);\n }", "public function addpassword()\n {\n\t\tif ($this->validate()) {\n\t\t\t$model = Userlogin::find()->where(['id' => Yii::$app->user->identity->id])->one();\n $model->setPassword_login($this->password);\t\t\t\t\n\t\t\tif ($model->save()) {\n\t\t\t\treturn true;\n\t\t\t}\n }\n return false;\n }", "public function store(Request $request){\n $request->validate([\n 'current_password' => ['required', 'min:8', 'password'],\n 'password' => ['required', 'min:8', 'confirmed', Rules\\Password::defaults()],\n ]);\n \n $user = Auth::user();\n\n /* if (Hash::check($request->current_password, $user->password)) {\n $request->user()->fill([\n 'password' => Hash::make($request->password)\n ])->save();\n }else{\n ;\n } */\n\n $request->user()->fill([\n 'password' => Hash::make($request->password)\n ])->save();\n\n //TODO success message\n\n\n return redirect(route('changepass.index'));\n }", "public function store(PasswoedValidation $request)\n {\n $user_id = Auth::id();\n $from_db = User::find($user_id)->password;\n if (Hash::check($request->old_password, $from_db )) {\n User::find($user_id)->update([\n 'password' => Hash::make($request->new_password)\n ]);\n }\n return back()->with('status', 'Password Change Successfully!');\n }", "public function post_password()\n\t{\n\t\t$input = Input::all();\n\t\t$rules = array(\n\t\t\t'current_password' => array(\n\t\t\t\t'required',\n\t\t\t),\n\t\t\t'new_password' => array(\n\t\t\t\t'required',\n\t\t\t\t'different:current_password',\n\t\t\t),\n\t\t\t'confirm_password' => array(\n\t\t\t\t'same:new_password',\n\t\t\t),\n\t\t);\n\n\t\tif (Auth::user()->id !== $input['id']) return Response::error('500');\n\n\t\t$val = Validator::make($input, $rules);\n\n\t\tif ($val->fails())\n\t\t{\n\t\t\treturn Redirect::to(handles('orchestra::account/password'))\n\t\t\t\t\t->with_input()\n\t\t\t\t\t->with_errors($val);\n\t\t}\n\n\t\t$msg = Messages::make();\n\t\t$user = Auth::user();\n\n\t\tif (Hash::check($input['current_password'], $user->password))\n\t\t{\n\t\t\t$user->password = $input['new_password'];\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tDB::transaction(function () use ($user)\n\t\t\t\t{\n\t\t\t\t\t$user->save();\n\t\t\t\t});\n\n\t\t\t\t$msg->add('success', __('orchestra::response.account.password.update'));\n\t\t\t}\n\t\t\tcatch (Exception $e)\n\t\t\t{\n\t\t\t\t$msg->add('error', __('orchestra::response.db-failed'));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$msg->add('error', __('orchestra::response.account.password.invalid'));\n\t\t}\n\n\t\treturn Redirect::to(handles('orchestra::account/password'));\n\t}", "public function newPassword() {\n $this->form_validation->set_rules('email', 'Email', 'required');\n $this->form_validation->set_rules('temp_code', 'Temporärer Code', 'required');\n $this->form_validation->set_rules('password', 'Passwort', 'required');\n \n if ($this->form_validation->run() === FALSE) {\n \t$this->error(400, 'Validation error');\n }\n \n $this->loadUser();\n \n if ($this->user_model->getValue('temp_code') != $this->input->post('temp_code')) {\n \t$this->error(404, 'Verification error');\n }\n \n if ($this->user_model->getValue('temp_code_valid_until') < date('Y-m-d H:i:s')) {\n \t$this->error(408, 'Provided code not valid anymore');\n }\n \n $this->user_model->setValue(\n \t'hashed_password',\n \tpassword_hash($this->input->post('password'), PASSWORD_DEFAULT));\n \t\n if (! $this->user_model->updatePassword()) {\n \t$this->error(400, 'Error wail updating password');\n }\n \n $data['new password'] = 'set';\n $this->response($data);\n }", "function regiomino_user_change_password($account, $password) {\r\n\t//watchdog('pwdaction', '@password', array('@password' => $password));\r\n $edit['pass'] = $password;\r\n user_save($account, $edit);\r\n}", "public function savePasswordToUser($user, $password);", "public function setpasswordAction(){\n $req=$this->getRequest();\n $cu=$this->aaac->getCurrentUser();\n $password=$this->getRequest()->getParam('password');\n $record=Doctrine_Query::create()->from('Users')->addWhere('ID=?')->fetchOne(array($req->getParam('id'))); \n $record->password=md5($password);\n if(!$record->trySave()){\n $this->errors->addValidationErrors($record);\n }\n $this->emitSaveData(); \n }", "function update_password()\n {\n }", "protected function afterValidate()\n {\n parent::afterValidate();\n if (!$this->hasErrors()) {\n $this->password = $this->hashPassword($this->password);\n }\n }", "protected function afterValidate()\n {\n parent::afterValidate();\n if (!$this->hasErrors()) {\n $this->password = $this->hashPassword($this->password);\n }\n }", "public function validatePassword() {\n if (!$this->hasErrors()) {\n $user = Yii::$app->user->identity;\n if (!$user || !$user->validatePassword($this->password_old)) {\n // $this->addError('password_old', 'Incorrect current password.');\n }\n }\n }", "public function validatePassword()\n {\n if (!$this->hasErrors()) {\n if (!$this->user->validatePassword($this->old_password)) {\n $this->addError('old_password', 'Incorrect email or password.');\n }\n }\n }", "public function password_validation()\n {\n $this->form_validation->set_rules('curtpassword', 'Current Password', 'callback_passwordcheck');\n $this->form_validation->set_rules('newpassword', 'New Password', 'required');\n $this->form_validation->set_rules('cpassword', 'Confirm Password', 'required|matches[newpassword]');\n if ($this->form_validation->run() == false) {\n $error = validation_errors();\n $this->session->set_flashdata('formerror', $error);\n redirect('vendor/change-password');\n } else {\n\t\t\t$password = $this->input->post('newpassword');\n\t\t\t$hash = $this->bcrypt->hash_password($password);\n\t\t\t\n if ($this->m_vendorDetail->changepass($this->id, $hash)) {\n $this->session->set_flashdata('success', 'Password updated Successfully');\n redirect('vendor/change-password');\n } else {\n $this->session->set_flashdata('error', 'unable to update your password, New password is matching with the current password!');\n redirect('vendor/change-password');\n }\n }\n\t}", "function testActivatePasswordSuccess() {\r\n $this->User = new User();\r\n \t\r\n\t\t$expected = $this->User->field('password', array('id'=>'1'));\t\r\n \t\r\n \t// should return the new password\r\n $password = $this->User->activatePassword('1bc29b36f623ba82aaf6724fd3b16718');\r\n $this->assertTrue($password);\r\n \r\n //checkk if the password has changed\r\n\t\t$result = $this->User->field('password', array('id'=>'1'));\t\r\n \t$this->assertNotEqual($result, $expected);\r\n \t\r\n \t//check if the returned password is the same as in the database\r\n \t$this->assertEqual(md5($password), $result);\r\n \t\r\n \t\r\n \t\r\n \t//test done set data to the original values\r\n \t$this->User->id=1;\r\n \t$this->User->saveField('password', $expected);\r\n \t$this->User->saveField('password_key', '1bc29b36f623ba82aaf6724fd3b16718');\r\n }", "public function setNewPassword($value) {\n\t\tif(!check($value)) throw new Exception(lang('error_92'));\n\t\tif(!Validator::AccountPassword($value)) throw new Exception(lang('error_92'));\n\t\t\n\t\t$this->_newPassword = $value;\n\t}", "public function validatePassword()\n {\n /* @var $user User */\n $user = Yii::$app->user->identity;\n if (!$user || !$user->validatePassword($this->oldPassword)) {\n $this->addError('oldPassword', 'Incorrect old password.');\n }\n }", "public function savenewPassword($random)\n {\n $this->setRules([ 'password' => 'required|min:6',//'password_confirmation' => 'required|same:password|min:6' \n ]);\n $this->_validate();\n $checkuser = $this->_customer->where('forgot_password', $random)->first();\n if (count($checkuser) > 0) {\n $checkuser->password = Hash::make($this->request->password);\n $checkuser->forgot_password = null;\n $checkuser->save();\n return true;\n } else {\n return false;\n }\n }", "public function userPasswordUpdate() {\n $password = Hash::make($this->request->input(\"new_password\"));\n $updateArray = [\n \"password\" => $password\n ];\n $whereArray = [\n [\"user_id\", '=', $this->request->input(\"user_id\")]\n ];\n $this->usersModel->setTableName(\"cvd_users\");\n $this->usersModel->setInsertUpdateData($updateArray);\n $this->usersModel->setWhere($whereArray);\n $this->usersModel->updateData();\n }" ]
[ "0.708261", "0.70323414", "0.70190877", "0.6993437", "0.6918978", "0.69044703", "0.68955225", "0.68760085", "0.68589246", "0.6848455", "0.68049973", "0.6799025", "0.67777383", "0.677607", "0.6745533", "0.6722055", "0.6696917", "0.66587484", "0.6650261", "0.6624472", "0.6620251", "0.6620251", "0.659864", "0.6566819", "0.6558107", "0.6548081", "0.6533008", "0.65176094", "0.64927703", "0.6489178" ]
0.7256017
0
Get all events grouped by year from the main site.
public function get_events_by_year() { switch_to_blog( get_network()->site_id ); $years = array(); foreach ($this->get_events() as $event) { $start = get_field( 'event_start', $event->ID ); if ( $start ) { $year = date( 'Y', strtotime( $start ) ); $years[ $year ][] = $event; } } restore_current_blog(); return $years; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getYearsOfEvents()\n {\n $qb = $this->entityManager->getRepository('Event\\Entity\\Event')\n ->createQueryBuilder('e')\n ->select('YEAR(e.eventStartDate) AS eYear')\n ->where('e.deleted = 0')\n ->groupBy('eYear')\n ->orderBy('eYear', 'DESC');\n\n $query = $qb->getQuery();\n $result = $query->getResult();\n return $result;\n }", "public function year($year = null)\n {\n return \\App\\Event::with('venue.city.states')\n ->whereYear('start_date', $year)\n ->orderby('start_date', 'asc')\n ->paginate($this->paginate);\n }", "public function get_timeline_events() {\r\n\t\t$contents[] = $this->get_content_posts();\r\n\t\t$contents[] = $this->get_content_tweets();\r\n\t\t$contents[] = $this->get_content_stories();\r\n\t\t\r\n\t\t$events = array();\r\n\t\t\r\n\t\t// Process each of the contents we have attempted to grab and combine them as events by year.\r\n\t\tforeach( $contents as $content ) {\r\n\t\t\tif( is_array ( $content ) ) {\r\n\t\t\t\tforeach ( $content as $date_group => $values ) {\r\n\t\t\t\t\tif( empty( $events[$date_group] ) || !isset( $events[$date_group] ) ) {\r\n\t\t\t\t\t\t$events[$date_group] = $values;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t$events[$date_group] = array_merge( $events[$date_group], $values);\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\tforeach( $events as $year=>&$event ) {\r\n\t\t\tusort( $event, array( &$this, 'sort_events_by_date' ) );\r\n\t\t}\r\n\t\t\r\n\t\tuksort( &$events, array( &$this, 'sort_date_groups' ) );\r\n\r\n\t\treturn $events;\r\n\t}", "public function getEventsYear(App\\Request $request)\n\t{\n\t\t$record = Vtiger_Calendar_Model::getInstance($request->getModule());\n\t\t$record->set('user', $request->getArray('user', 'Alnum'));\n\t\t$record->set('time', $request->isEmpty('time') ? '' : $request->getByType('time'));\n\t\tif ($request->has('start') && $request->has('end')) {\n\t\t\t$record->set('start', $request->getByType('start', 'DateInUserFormat'));\n\t\t\t$record->set('end', $request->getByType('end', 'DateInUserFormat'));\n\t\t}\n\t\tif ($request->has('filters')) {\n\t\t\t$record->set('filters', $request->getByType('filters', 'Alnum'));\n\t\t}\n\t\tif ($request->has('cvid')) {\n\t\t\t$record->set('customFilter', $request->getInteger('cvid'));\n\t\t}\n\t\t$entity = array_merge($record->getEntityYearCount(), $record->getPublicHolidays());\n\t\t$response = new Vtiger_Response();\n\t\t$response->setResult($entity);\n\t\t$response->emit();\n\t}", "function get_all_by_key_by_year() {\t\n\t\t$sql = \"SELECT * \n\t\t\t\tFROM evs_database.evs_set_form_g_and_o\n\t\t\t\tWHERE sfg_pos_id = ? AND sfg_pay_id = ?\";\n\t\t$query = $this->db->query($sql, array($this->sfg_pos_id, $this->sfg_pay_id));\n\t\treturn $query;\n\t}", "public function getEventsYear(App\\Request $request)\n\t{\n\t\t$record = Calendar_Calendar_Model::getCleanInstance();\n\t\t$record->set('user', $request->getArray('user', 'Alnum'));\n\t\t$record->set('time', $request->getByType('time'));\n\t\tif ($request->has('start') && $request->has('end')) {\n\t\t\t$record->set('start', $request->getByType('start', 'DateInUserFormat'));\n\t\t\t$record->set('end', $request->getByType('end', 'DateInUserFormat'));\n\t\t}\n\t\tif ($request->has('filters')) {\n\t\t\t$record->set('filters', $request->getByType('filters', 'Alnum'));\n\t\t}\n\t\tif ($request->has('cvid')) {\n\t\t\t$record->set('customFilter', $request->getInteger('cvid'));\n\t\t}\n\t\t$entity = array_merge($record->getEntityYearCount(), $record->getPublicHolidays());\n\t\t$response = new Vtiger_Response();\n\t\t$response->setResult($entity);\n\t\t$response->emit();\n\t}", "function findEvents($url=array()) {\n\t\t$events = $this->find('all',array('conditions'=>array('YEAR(date)='.$url['year'].' AND MONTH(date)='.$url['month']),'recursive'=>2));\n\t\tif ($url['tag'] != 'all') {\n\t\t\t$events = $this->findEventsByTag($events,$url['tag']);\n\t\t}\n\t\t\n\t\tif ($url['calendar'] != 'all' && $url['tag'] == 'all') {\n\t\t\t$events = $this->findEventsByCalendar($events,$url['calendar']);\n\t\t}\n\t\treturn $events;\n\t}", "public function eventsAction()\n {\n $year = $this->params()->fromQuery('year', date('Y'));\n $container = $this->getEvent()->getApplication()->getServiceManager();\n $adapter = $container->get('Application\\Service\\Adapter');\n $sql = \"SELECT * FROM events WHERE event_date LIKE ? ORDER BY event_date\";\n $events = $adapter->query($sql, Adapter::QUERY_MODE_PREPARE);\n $events->execute([$year . '%']);\n return new ViewModel(['events' => $events, 'year' => $year]);\n }", "function getMediaYears($date)\n{\n $sql = \"SELECT media_year,media_year_start,media_year_end from media_calendar where media_year <= YEAR('\" . $date . \"') GROUP by media_year ORDER BY media_year DESC\";\n $result = getResult($sql);\n return $result;\n}", "function events($year, $month)\n {\n $cursor = '';\n $events = array();\n\n // Tadpoles returns events spread across multiple pages of data.\n // Keep grabbing the next page until we've exhausted all available events.\n do {\n $month = str_pad($month, 2, '0', STR_PAD_LEFT);\n\n $last_day = date('t', strtotime(\"$year-$month-01\"));\n $last_day = str_pad($last_day, 2, '0', STR_PAD_LEFT);\n\n $earliest_ts = strtotime(\"$year-$month-01 00:00:00\");\n $latest_ts = strtotime(\"$year-$month-$last_day 23:59:59\");\n\n $params = array('num_events' => '100', 'state' => 'client', 'direction' => 'range', 'earliest_event_time' => $earliest_ts, 'latest_event_time' => $latest_ts, 'cursor' => $cursor);\n $jsonStr = curl('https://www.tadpoles.com/remote/v1/events?' . http_build_query($params));\n $json = json_decode($jsonStr);\n\n $events = array_merge($events, $json->events);\n $cursor = $json->cursor;\n } while(isset($json->cursor) && strlen($json->cursor) > 0);\n\n return $events;\n }", "function get_all_by_key_by_year(){\n\t\t$sql = \"SELECT * \n\t\t\t\tFROM evs_database.evs_set_form_attitude\n\t\t\t\tWHERE sft_pos_id = ? AND sft_pay_id = ?\";\n $query = $this->db->query($sql, array($this->sft_pos_id, $this->sft_pay_id));\n\t\treturn $query;\n\n\t}", "public function year_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(\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'default' => 'year-01-01'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'date_range_end',\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' => 'limit',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'integer',\n\t\t\t\t\t'default' => 100\n\t\t\t\t\t)\n\t\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\t\tif ($this->P->value('date_range_end') === FALSE)\n\t\t{\n\t\t\t$this->P->set('date_range_end', $this->CDT->add_year($this->P->value('limit')));\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 = ($this->P->value('date_range_end', 'ymd') > $this->P->value('date_range_start', 'ymd')) ? 1 : -1;\n\t\t$output = '';\n\t\t$count = 0;\n\n//ee()->TMPL->log_item('Calendar: Looping');\n\n\t\tdo {\n\t\t\t$vars['conditional']\t= array\t(\t'is_current_year'\t\t=>\t($this->CDT->year == $today['year']) ? TRUE : FALSE,\n\t\t\t\t\t\t\t\t\t\t\t\t'is_not_current_year'\t=>\t($this->CDT->year == $today['year']) ? FALSE : TRUE\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t$vars['single']\t= array('year'\t=> $this->CDT->year);\n\t\t\t$vars['date']\t= array(\n\t\t\t\t'year'\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t'date'\t\t=> $this->CDT->datetime_array(),\n\t\t\t);\n\t\t\t$output .= $this->swap_vars($vars, ee()->TMPL->tagdata);\n\t\t\t$this->CDT->add_year($dir);\n\t\t\t$count++;\n\t\t} while ($count < $this->P->value('limit') AND $this->CDT->year < $this->P->value('date_range_end', 'year'));\n\n\t\treturn $output;\n\t}", "function get_entries_records_for_year($entries, $year, $boundle)\n{\n $dates = get_year_dates($year);\n // Setting the start date is the first day of the selected year.\n $start_date = $dates['start_date'];\n // Setting the end date is the last day of the selected year.\n $end_date = $dates['end_date'];\n\n $entries_records = [];\n if (isset($entries)) {\n foreach ($entries as $entry) {\n $query = new EntityFieldQuery();\n $query->entityCondition('entity_type', 'entry_month_record')\n ->entityCondition('bundle', $boundle)\n ->fieldCondition('field_entry', 'target_id', $entry, '=')\n ->fieldCondition('field_entry_date', 'value', $start_date, '>=')\n ->fieldCondition('field_entry_date', 'value', $end_date, '<=')\n ->fieldOrderBy('field_entry_date', 'value')\n ->addMetaData('account', user_load(1));\n\n $records = $query->execute();\n\n if (!empty($records)) {\n $records_ids = array_keys($records['entry_month_record']);\n\n // Adding each records for an entry in the array of entry id.\n $entries_records[$entry] = $records_ids;\n }\n }\n }\n\n return $entries_records;\n}", "public function findAllYears()\n {\n $query = 'SELECT DISTINCT t.year FROM ApiTracklistBundle:Track t ORDER BY t.year DESC';\n\n return $this->getEntityManager()\n ->createQuery($query)\n ->getResult();\n }", "public function groupMatchesByYear()\n {\n $matches = $this->matchService->groupMatchesByYear();\n return response()->json(['message' => 'Retrieved Successfully', 'data' => $matches], Response::HTTP_OK);\n }", "public function getAllEvents(){\n\t\t//$events = EventPage::get()->sort('Date', 'DESC')->limit(5);\n\t\t$limit = 10;\n\n\t\t$items = DataObject::get(\"EventPage\", \"Date > NOW()\", \"Date\", null, $limit);\n\t\treturn $items;\n\n\t}", "function this_year()\n{\n global $db; // golbalize db variable:\n $thisYear = date('Y') . '-01-01';\n $nextYear = ((int) date('Y') + 1) . '-01-01';\n $datesIds = $db->getMany(DATES, [\n 'date' => $thisYear,\n 'dates.date' => $nextYear,\n ], ['id', 'date'], ['date' => '>=', 'dates.date' => '<=']);\n if ($db->count > 0) {\n return $datesIds;\n }\n}", "function icalendar_get_events( $url = '', $count = 5 ) {\n\t// Find your calendar's address http://support.google.com/calendar/bin/answer.py?hl=en&answer=37103\n\t$ical = new iCalendarReader();\n\treturn $ical->get_events( $url, $count );\n}", "public static function getHolidaysInYear($year) {\n $criteria = new CDbCriteria();\n $criteria->addCondition('YEAR(t.date) = ' . $year);\n $models = self::model()->findAll($criteria);\n $aRetVal = [];\n foreach ($models as $model) {\n // Check if plan was approved\n $plan = HrHolidayPlans::model()->findByPk($year);\n if ($plan && $plan->isApproved()) {\n $aRetVal[$model->date] = $model->date;\n }\n }\n \n return $aRetVal;\n }", "function GetYearList() {\n\t\t$companyid = $this->companyID;\n\t\t$emp_seqno = $this->empSeqNo;\n\t\t$sql_string = <<<_YearHolidayList_\n\t\t\t\tselect my_year as year1,\n\t\t\t\t\t my_year as year2\n\t\t\t\t from ehr_year_holiday_v\n\t\t\t\t where company_id = '$companyid'\n and emp_seq_no = '$emp_seqno'\n\t\t\t\t group by my_year\n\t\t\t\t order by my_year desc\n_YearHolidayList_;\n\t\treturn $this->DBConn->GetArray($sql_string);\n\t}", "public function getAllYears()\n\t{\n\t\treturn array_map(function ($election) {\n\t\t\t/** @var Election $election */\n\t\t\treturn date('Y', $election->getDate()->getTimestamp());\n\t\t}, $this->getAll());\n\t}", "function get_flat_entries_records_for_year($entries, $year, $bundle)\n{\n\n $dates = get_year_dates($year);\n // Setting the start date is the first day of the selected year.\n $start_date = $dates['start_date'];\n // Setting the end date is the last day of the selected year.\n $end_date = $dates['end_date'];\n\n if (!empty($entries)) {\n $query = new EntityFieldQuery();\n $query->entityCondition('entity_type', 'entry_month_record')\n ->entityCondition('bundle', $bundle)\n ->fieldCondition('field_entry', 'target_id', $entries, 'IN')\n ->fieldCondition('field_entry_date', 'value', $start_date, '>=')\n ->fieldCondition('field_entry_date', 'value', $end_date, '<=')\n ->fieldOrderBy('field_entry_date', 'value')\n ->addMetaData('account', user_load(1));\n $records = $query->execute();\n if (!empty($records)) {\n $records_ids = array_keys($records['entry_month_record']);\n // Adding each records for an entry in the array of entry id.\n }\n } else {\n return [];\n }\n\n return $records_ids;\n}", "function get_squarecandy_events_year_nav() {\n\tif ( wp_date( 'Y' ) === get_transient( 'squarecandy_events_year_archive_update' ) ) {\n\t\treturn false;\n\t}\n\n\t// needs updating\n\tupdate_squarecandy_archive_year_list();\n\n}", "public function fetchYears()\n\t{\n\t\treturn $this->dibi->fetchAll('\n\t\t\tSELECT\n\t\t\t\tyear\n\t\t\tFROM\n\t\t\t\tjournal\n\t\t\tGROUP BY\n\t\t\t\tyear\n\t\t\tORDER BY\n\t\t\t\tyear\t\t\n\t\t');\n\t\t\t\n\t}", "public function getAllSaintsDay($year)\n {\n $date = new \\DateTime($year.'-10-31');\n for ($i = 0; $i < 7; $i++) {\n if ($date->format('w') == 6) {\n break;\n }\n $date->add(new \\DateInterval('P1D'));\n }\n\n return $date;\n }", "function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customerid=0, $userid=0, $type = 0, $privacy = 0, $closed = '') {\n\tglobal $AUTH;\n\n\t$DB = LMSDB::getInstance();\n\n\t$t = time();\n\n\tif(!$year) $year = date('Y', $t);\n\tif(!$month) $month = date('n', $t);\n\tif(!$day) $day = date('j', $t);\n\n\tunset($t);\n\n\tswitch ($privacy) {\n\t\tcase 0:\n\t\t\t$privacy_condition = '(private = 0 OR (private = 1 AND userid = ' . intval(Auth::GetCurrentUser()) . '))';\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\t$privacy_condition = 'private = 0';\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t$privacy_condition = 'private = 1 AND userid = ' . intval(Auth::GetCurrentUser());\n\t\t\tbreak;\n\t}\n\n\t$startdate = mktime(0,0,0, $month, $day, $year);\n\t$enddate = mktime(0,0,0, $month, $day+$forward, $year);\n\n\tif(!isset($userid) && empty($userid))\n\t\t$userfilter = '';\n\telse\n\t{\n\t\tif(is_array($userid))\n\t\t{\n\t\t\t$userfilter = ' AND EXISTS ( SELECT 1 FROM eventassignments WHERE eventid = events.id AND userid IN ('.implode(',', $userid).'))';\n\t\t\tif(in_array('-1', $userid))\n\t\t\t\t$userfilter = ' AND NOT EXISTS (SELECT 1 FROM eventassignments WHERE eventid = events.id)';\n\t\t}\n\t}\n\n\t$list = $DB->GetAll(\n\t\t'SELECT events.id AS id, title, note, description, date, begintime, enddate, endtime, customerid, closed, events.type, '\n\t\t.$DB->Concat('UPPER(c.lastname)',\"' '\",'c.name').' AS customername,\n\t\tuserid, vusers.name AS username, '.$DB->Concat('c.city',\"', '\",'c.address').' AS customerlocation,\n\t\tevents.address_id, va.location, nodeid, vn.location AS nodelocation, ticketid\n\t\tFROM events\n\t\tLEFT JOIN vaddresses va ON va.id = events.address_id\n\t\tLEFT JOIN vnodes as vn ON (nodeid = vn.id)\n\t\tLEFT JOIN customerview c ON (customerid = c.id)\n\t\tLEFT JOIN vusers ON (userid = vusers.id)\n\t\tWHERE ((date >= ? AND date < ?) OR (enddate <> 0 AND date < ? AND enddate >= ?)) AND ' . $privacy_condition\n\t\t.($customerid ? ' AND customerid = '.intval($customerid) : '')\n\t\t. $userfilter\n\t\t. (!empty($type) ? ' AND events.type ' . (is_array($type) ? 'IN (' . implode(',', array_filter($type, 'intval')) . ')' : '=' . intval($type)) : '')\n\t\t. ($closed != '' ? ' AND closed = ' . intval($closed) : '')\n\t\t.' ORDER BY date, begintime',\n\t\t array($startdate, $enddate, $enddate, $startdate, Auth::GetCurrentUser()));\n\n\t$list2 = array();\n\tif ($list)\n\t\tforeach ($list as $idx => $row) {\n\t\t\t$row['userlist'] = $DB->GetAll('SELECT userid AS id, vusers.name\n\t\t\t\t\tFROM eventassignments, vusers\n\t\t\t\t\tWHERE userid = vusers.id AND eventid = ? ',\n\t\t\t\t\tarray($row['id']));\n\t\t\t$endtime = $row['endtime'];\n\t\t\tif ($row['enddate'] && $row['enddate'] - $row['date']) {\n\t\t\t\t$days = round(($row['enddate'] - $row['date']) / 86400);\n\t\t\t\t$row['enddate'] = $row['date'] + 86400;\n\t\t\t\t$row['endtime'] = 0;\n\t\t\t\t$dst = date('I', $row['date']);\n\t\t\t\t$list2[] = $row;\n\t\t\t\twhile ($days) {\n\t\t\t\t\tif ($days == 1)\n\t\t\t\t\t\t$row['endtime'] = $endtime;\n\t\t\t\t\t$row['date'] += 86400;\n\t\t\t\t\t$newdst = date('I', $row['date']);\n\t\t\t\t\tif ($newdst != $dst) {\n\t\t\t\t\t\tif ($newdst < $dst)\n\t\t\t\t\t\t\t$row['date'] += 3600;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$row['date'] -= 3600;\n\t\t\t\t\t\t$newdst = date('I', $row['date']);\n\t\t\t\t\t}\n\t\t\t\t\tlist ($year, $month, $day) = explode('/', date('Y/n/j', $row['date']));\n\t\t\t\t\t$row['date'] = mktime(0, 0, 0, $month, $day, $year);\n\t\t\t\t\t$row['enddate'] = $row['date'] + 86400;\n\t\t\t\t\tif ($days > 1 || $endtime)\n\t\t\t\t\t\t$list2[] = $row;\n\t\t\t\t\t$days--;\n\t\t\t\t\t$dst = $newdst;\n\t\t\t\t}\n\t\t\t} else\n\t\t\t\t$list2[] = $row;\n\t\t}\n\n\treturn $list2;\n}", "public function getEvents(){\n\t\t// prepares the request\n\t\t$ch = curl_init();\n\t\tcurl_setopt($ch, CURLOPT_URL, \"http://\" . IP . \"/bde_site/api/event\");\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . TOKEN));\n\n\t\t// send the request\n\t\t$output = curl_exec($ch);\n\t\t$info = curl_getinfo($ch);\n\t\tcurl_close($ch);\n\n\t\t// decode the reponse of the API\n\t\t$events = json_decode($output, true);\n\n\t\t// format the date\n\t\tforeach ($events as $key => $event) {\n\t\t\t$events[$key]['date'] = explode('T', $event['date'])[0];\n\t\t}\n\n\t\t// if the user is not connected or if he is a student, remove events which are not public\n\t\tif (!isset($_SESSION['status']) || $_SESSION['status'] == 'student'){\n\t\t\t$publicEvents = [];\n\t\t\t$eventNumber = sizeof($events);\n\t\t\tfor($i=0 ; $i < $eventNumber; $i++){\n\t\t\t\t$event = array_shift($events);\n\t\t\t\tif($event['is_public'] == 1){\n\t\t\t\t\tarray_push($publicEvents, $event);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $publicEvents;\n\t\t}\n\n\t\t// return all events\n\t\treturn $events;\n\t}", "public function index_should_return_a_collection_of_records()\r\n {\r\n // by year collection\r\n $this->get('/holidays/us/2018/');\r\n $body = json_decode($this->response->getContent(), true );\r\n $this->assertArrayHasKey('holidays', $body);\r\n $this->assertCount(47, $body['holidays']);\r\n $this->assertArrayHasKey('2018-02-19', $body['holidays']);\r\n\r\n $arr= $body['holidays']['2018-02-19'];\r\n $this->assertCount(1, $arr);\r\n $this->assertEquals( $arr[0]['name'], 'Washington\\'s Birthday');\r\n $this->assertEquals( $arr[0]['country'], 'us');\r\n $this->assertEquals( $arr[0]['date'], '2018-02-19');\r\n $this->assertEquals( $arr[0]['public'], '0');\r\n\r\n ///////////////////////////////\r\n // public\r\n $this->get('/holidays/us/2018/?public=1');\r\n $body = json_decode($this->response->getContent(), true );\r\n $this->assertArrayHasKey('holidays', $body);\r\n $this->assertCount(7, $body['holidays']);\r\n $this->assertArrayHasKey('2018-01-01', $body['holidays']);\r\n\r\n $arr= $body['holidays']['2018-01-01'];\r\n $this->assertCount(2, $arr);\r\n $this->assertEquals( $arr[1]['name'], 'New Year\\'s Day');\r\n $this->assertEquals( $arr[1]['country'], 'us');\r\n $this->assertEquals( $arr[1]['date'], '2018-01-01');\r\n $this->assertEquals( $arr[1]['public'], '1');\r\n\r\n ///////////////////////\r\n // month\r\n $this->get('/holidays/us/2018/?month=3')\r\n ->seeJson( [\r\n 'status'=> 200,\r\n 'message'=>'succeeded with content',\r\n 'holidays'=>[\r\n [\r\n 'name'=>'International Women\\'s Day',\r\n 'country'=> 'us',\r\n 'date'=>'2018-03-08',\r\n 'public'=> 0\r\n ],\r\n [\r\n 'name'=>'Saint Patrick\\'s Day',\r\n 'country'=> 'us',\r\n 'date'=>'2018-03-17',\r\n 'public'=> 0\r\n ],\r\n [\r\n 'name'=>'Palm Sunday',\r\n 'country'=> 'us',\r\n 'date'=>'2018-03-25',\r\n 'public'=> 0\r\n ],\r\n [\r\n 'name'=>'Good Friday',\r\n 'country'=> 'us',\r\n 'date'=>'2018-03-30',\r\n 'public'=> 1\r\n ]\r\n ]\r\n ] );\r\n }", "private function _get_calendar_array()\n\t{\n\t $this->all_events = $this->result->xpath(\".//event\");\n\t \n\t foreach($this->all_events as $an_event):\n\t $start_at = $an_event->xpath(\"./start-at\");\n \t $start_at = $start_at[0];\n \t $end_at = $an_event->xpath(\"./end-at\");\n \t $end_at = $end_at[0];\n \t \n \t $start_at = new DateTime($start_at);\n \t $start_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $start_at->setTime(0, 0, 0);\n \t $end_at = new DateTime($end_at);\n \t $end_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $end_at->setTime(0, 0, 0);\n \t \n \t $start_timestamp = strtotime($start_at->format('Y-m-d'));\n $end_timestamp = strtotime($end_at->format('Y-m-d'));\n \n $start_year = date(\"Y\", $start_timestamp);\n $end_year = date(\"Y\", $end_timestamp);\n $start_month = date(\"m\", $start_timestamp);\n $end_month = date(\"m\", $end_timestamp);\n $start_day = date(\"d\", $start_timestamp);\n $start_day = $start_day + 1;\n $end_day = date(\"d\", $end_timestamp);\n $end_day = $end_day + 1;\n \n if(($start_year == $this->year && $start_month == $this->month) || ($end_year == $this->year && $end_month == $this->month)):\n if($start_year == $end_year):\n if($start_month == $end_month):\n $this->_calendar_array_one($start_day, $end_day);\n else:\n if($end_month != $this->month):\n $this->_calendar_array_two($start_day);\n else:\n $this->_calendar_array_three($end_day);\n endif;\n endif;\n endif;\n endif;\n endforeach;\n \n\t foreach($this->callinks as $callinks):\n\t foreach($callinks as $key => $value):\n\t $this->combined_callinks[\"$key\"] = $value;\n\t endforeach;\n\t endforeach;\n\t}", "public function GetAllFacturesVentesByYear() {\n if ($this->get_request_method() != \"POST\") {\n $this->response('', 406);\n }\n \n if (isset($_REQUEST['data'])) {\n $idSociete = $_REQUEST['data'][\"idSociete\"];\n $filterYear = $_REQUEST['data'][\"filterYear\"];\n // Input validations\n if (!empty($idSociete) && !empty($filterYear)) {\n try {\n $sql = $this->db->prepare(\"SELECT idFacture,date as dateCre,total,YEAR(date) AS factYear FROM facturevente WHERE idEtat != 5 and YEAR(date) = :filterYear AND idSociete = :idSociete\");\n $sql->bindParam('idSociete', $idSociete, PDO::PARAM_INT);\n $sql->bindParam('filterYear', $filterYear, PDO::PARAM_STR);\n $sql->execute();\n\n if ($sql->rowCount() > 0) {\n $result = array();\n while ($rlt = $sql->fetchAll()) {\n $result[] = $rlt;\n }\n // If success everythig is good send header as \"OK\" and return list of users in JSON format\n $this->response($this->json($result[0]), 200);\n }\n $this->response('', 204); // If no records \"No Content\" status\n } catch (Exception $ex) {\n $this->response('', $ex->getMessage());\n }\n }\n }\n \n }" ]
[ "0.6634203", "0.6416047", "0.62959236", "0.6189904", "0.6116527", "0.6100796", "0.60418874", "0.6010047", "0.59350014", "0.59234107", "0.58710515", "0.5830806", "0.5779693", "0.5731799", "0.5724064", "0.57094616", "0.56512785", "0.56471294", "0.5624089", "0.5600589", "0.55955863", "0.55499166", "0.55245435", "0.5499521", "0.54674894", "0.5456779", "0.545542", "0.54513943", "0.53673375", "0.53481233" ]
0.77518725
0
Generated from protobuf field string BatchID = 1;
public function getBatchID() { return $this->BatchID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setBatchID($var)\n {\n GPBUtil::checkString($var, True);\n $this->BatchID = $var;\n\n return $this;\n }", "function getBatchID()\n\t\t{\n\t\t\treturn $this->BatchID;\n\t\t}", "public function get_batch_id()\n {\n $results = $this->results();\n\n return $results['SubmitNotificationBatchResult']->BatchID;\n }", "function setBatchID($BatchID)\n\t\t{\n\t\t\t$this->BatchID = $BatchID;\n\t\t}", "function get_batch_id() {\n global $_REQUEST;\n if (!(isset($_REQUEST['batch_id'])\n && is_string($_REQUEST['batch_id'])\n && preg_match('/^\\{?[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}\\}?$/i', $_REQUEST['batch_id']))) {\n hs_ajax_result(false, \"hack attach!\", null);\n }\n\n return $_REQUEST['batch_id'];\n}", "public function fetchBatchId ()\r\n {\r\n $member_id = $this->getMember_id(true);\r\n $student_class_object = new Acad_Model_StudentClass();\r\n $student_class_object->setMember_id($member_id);\r\n $batch_identifier_class_id = $student_class_object->fetchBatchIdentifierClassId();\r\n $class_object = new Acad_Model_Class();\r\n $class_object->setClass_id($batch_identifier_class_id);\r\n $class_object->fetchInfo();\r\n $batch_id = $class_object->getBatch_id();\r\n return $batch_id;\r\n }", "public function getBatchCode()\n {\n $params = $this->getRequest()->getPost();\n $batch_number = $params['batch_number'];\n if (!$batch_number) {\n $id = (int) $params['entity_id'];\n if (!$id) {\n $id = $this->getRequest()->getParam('id', null); //Get batch id\n }\n if ($id) {\n $batch_number = Mage::getModel('batchcode/batchcode')\n ->load($id)\n ->getBatchNumber();\n }\n }\n\n if (!$batch_number) {\n $batch_number = Mage::helper('batchcode')->__('Invalid');\n }\n\n return $batch_number;\n }", "public function actionGetStackerBatchId(){\n $this->pageTitle = 'Stacker API - Get Stacker Batch ID';\n $result = '';\n \n if(isset($_POST['TerminalName']) || isset($_POST['MembershipCardNumber'])){\n $terminalName = $_POST['TerminalName'];\n $mcardnumber = $_POST['MembershipCardNumber'];\n \n $result = $this->_getStackerBatchId($terminalName, $mcardnumber);\n }\n \n $this->render('getStackerBatchId', array('result'=>$result));\n }", "function getBatchObj()\n\t\t{\n\t\t\treturn $this->BatchObj;\n\t\t}", "public function getBatch()\n {\n return $this->_batch;\n }", "public function get_start_batch(): string\n {\n return $this->start_batch;\n }", "function _civicrm_api3_entity_batch_create_spec(&$params) {\n $params['entity_id']['api.required'] = 1;\n $params['batch_id']['api.required'] = 1;\n}", "public function hasBatchid(){\n return $this->_has(3);\n }", "public function getBatch()\n {\n return isset($this->batch) ? $this->batch : null;\n }", "function getThisBatchId($db) {\n\t\t$batchId=0;\n\t\t$res=$db->query(\"SELECT MIN(id) as id_min FROM batch\");\n\t\twhile($row=$res->fetch_assoc()) {\n\t\t\t$batchId=$row[\"id_min\"];\n\t\t}\n\t\treturn $batchId+1;\n\t}", "public function getBatchQuantity()\n {\n return $this->batchQuantity;\n }", "public function id()\n {\n return $this->identity['jobId'];\n }", "public function getNextBatchNumber()\n {\n return $this->getLastBatchNumber() + 1;\n }", "public function getBatchToken(): ?string\n {\n return $this->batchToken;\n }", "public function schemaDefinition() {\n return [\n 'description' => 'Stores details about batches (processes that run in multiple HTTP requests).',\n 'fields' => [\n 'bid' => [\n 'description' => 'Primary Key: Unique batch ID.',\n // This is not a serial column, to allow both progressive and\n // non-progressive batches. See batch_process().\n 'type' => 'int',\n 'unsigned' => TRUE,\n 'not null' => TRUE,\n ],\n 'token' => [\n 'description' => \"A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.\",\n 'type' => 'varchar_ascii',\n 'length' => 64,\n 'not null' => TRUE,\n ],\n 'timestamp' => [\n 'description' => 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.',\n 'type' => 'int',\n 'not null' => TRUE,\n ],\n 'batch' => [\n 'description' => 'A serialized array containing the processing data for the batch.',\n 'type' => 'blob',\n 'not null' => FALSE,\n 'size' => 'big',\n ],\n ],\n 'primary key' => ['bid'],\n 'indexes' => [\n 'token' => ['token'],\n ],\n ];\n }", "public function getBatch()\n\t{\n\t\tif (! is_int(self::$batch))\n\t\t{\n\t\t\t$batch = $this->db->table($this->table)\n\t\t\t\t->selectMax('batch')\n\t\t\t\t->get()->getResultObject();\n\t\t\t$batch = empty($batch) ? 0 : (int) reset($batch)->batch;\n\n\t\t\tself::$batch = $batch + 1;\n\t\t}\n\n\t\treturn self::$batch;\n\t}", "public function setBatch($value)\n {\n $this->_batch = $value;\n return $this;\n }", "public function setBatch(Batch $batch)\n {\n $this->batch = $batch;\n }", "function get_batch($batch_id)\n {\n return $this->db->get_where('batch',array('batch_id'=>$batch_id))->row_array();\n }", "function delete_batch($batch_id)\n {\n return $this->db->delete('batch',array('batch_id'=>$batch_id));\n }", "protected function getBatchCacheKey(ObjectIdentityInterface $oid)\n {\n return $oid->getType() . '_' . $this->getBatchNumber($oid);\n }", "public function get_end_batch(): string\n {\n return $this->end_batch;\n }", "public function __construct(array $batch)\n\t{\n\t\tif(Tivoka::$version == Tivoka::VER_1_0) throw new Tivoka_exception('Batch requests are not supported by JSON-RPC 1.0 spec', Tivoka::ERR_SPEC_INCOMPATIBLE);\n\t\t$this->id = array();\n\t\n\t\t//prepare requests...\n\t\tforeach($batch as $request)\n\t\t{\n\t\t\tif(!($request instanceof Tivoka_Request) && !($request instanceof Tivoka_Notification))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t//request...\n\t\t\tif($request instanceof Tivoka_Request)\n\t\t\t{\n\t\t\t\tif(in_array($request->id,$this->id,true)) continue;\n\t\t\t\t$this->id[$request->id] = $request;\n\t\t\t}\n\t\t\t\n\t\t\t$this->request[] = $request->request;\n\t\t}\n\t}", "public function getOrCreateBatch()\n {\n $batch = DB::table('job_batches')->where('name', '=', 'Process Csv')->first();\n if (!$batch) {\n try {\n return Bus::batch([])->name('Process Csv')->dispatch();\n } catch (\\Throwable $e) {\n }\n }\n return Bus::findBatch($batch->id);\n }", "public function requestBatchSatus($batchId);" ]
[ "0.7591301", "0.7506304", "0.72075903", "0.67298156", "0.64076585", "0.6348025", "0.59486574", "0.58121145", "0.58113956", "0.57880896", "0.5721433", "0.5570651", "0.55528086", "0.55322933", "0.55178195", "0.5318432", "0.5308517", "0.5267166", "0.52521724", "0.52351195", "0.52215165", "0.521892", "0.52040946", "0.51894766", "0.51865286", "0.5174539", "0.5163068", "0.5149745", "0.5141627", "0.5128119" ]
0.75993687
0
Generated from protobuf field string BatchID = 1;
public function setBatchID($var) { GPBUtil::checkString($var, True); $this->BatchID = $var; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getBatchID()\n {\n return $this->BatchID;\n }", "function getBatchID()\n\t\t{\n\t\t\treturn $this->BatchID;\n\t\t}", "public function get_batch_id()\n {\n $results = $this->results();\n\n return $results['SubmitNotificationBatchResult']->BatchID;\n }", "function setBatchID($BatchID)\n\t\t{\n\t\t\t$this->BatchID = $BatchID;\n\t\t}", "function get_batch_id() {\n global $_REQUEST;\n if (!(isset($_REQUEST['batch_id'])\n && is_string($_REQUEST['batch_id'])\n && preg_match('/^\\{?[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}\\}?$/i', $_REQUEST['batch_id']))) {\n hs_ajax_result(false, \"hack attach!\", null);\n }\n\n return $_REQUEST['batch_id'];\n}", "public function fetchBatchId ()\r\n {\r\n $member_id = $this->getMember_id(true);\r\n $student_class_object = new Acad_Model_StudentClass();\r\n $student_class_object->setMember_id($member_id);\r\n $batch_identifier_class_id = $student_class_object->fetchBatchIdentifierClassId();\r\n $class_object = new Acad_Model_Class();\r\n $class_object->setClass_id($batch_identifier_class_id);\r\n $class_object->fetchInfo();\r\n $batch_id = $class_object->getBatch_id();\r\n return $batch_id;\r\n }", "public function getBatchCode()\n {\n $params = $this->getRequest()->getPost();\n $batch_number = $params['batch_number'];\n if (!$batch_number) {\n $id = (int) $params['entity_id'];\n if (!$id) {\n $id = $this->getRequest()->getParam('id', null); //Get batch id\n }\n if ($id) {\n $batch_number = Mage::getModel('batchcode/batchcode')\n ->load($id)\n ->getBatchNumber();\n }\n }\n\n if (!$batch_number) {\n $batch_number = Mage::helper('batchcode')->__('Invalid');\n }\n\n return $batch_number;\n }", "public function actionGetStackerBatchId(){\n $this->pageTitle = 'Stacker API - Get Stacker Batch ID';\n $result = '';\n \n if(isset($_POST['TerminalName']) || isset($_POST['MembershipCardNumber'])){\n $terminalName = $_POST['TerminalName'];\n $mcardnumber = $_POST['MembershipCardNumber'];\n \n $result = $this->_getStackerBatchId($terminalName, $mcardnumber);\n }\n \n $this->render('getStackerBatchId', array('result'=>$result));\n }", "function getBatchObj()\n\t\t{\n\t\t\treturn $this->BatchObj;\n\t\t}", "public function getBatch()\n {\n return $this->_batch;\n }", "public function get_start_batch(): string\n {\n return $this->start_batch;\n }", "function _civicrm_api3_entity_batch_create_spec(&$params) {\n $params['entity_id']['api.required'] = 1;\n $params['batch_id']['api.required'] = 1;\n}", "public function hasBatchid(){\n return $this->_has(3);\n }", "public function getBatch()\n {\n return isset($this->batch) ? $this->batch : null;\n }", "function getThisBatchId($db) {\n\t\t$batchId=0;\n\t\t$res=$db->query(\"SELECT MIN(id) as id_min FROM batch\");\n\t\twhile($row=$res->fetch_assoc()) {\n\t\t\t$batchId=$row[\"id_min\"];\n\t\t}\n\t\treturn $batchId+1;\n\t}", "public function getBatchQuantity()\n {\n return $this->batchQuantity;\n }", "public function id()\n {\n return $this->identity['jobId'];\n }", "public function getNextBatchNumber()\n {\n return $this->getLastBatchNumber() + 1;\n }", "public function getBatchToken(): ?string\n {\n return $this->batchToken;\n }", "public function schemaDefinition() {\n return [\n 'description' => 'Stores details about batches (processes that run in multiple HTTP requests).',\n 'fields' => [\n 'bid' => [\n 'description' => 'Primary Key: Unique batch ID.',\n // This is not a serial column, to allow both progressive and\n // non-progressive batches. See batch_process().\n 'type' => 'int',\n 'unsigned' => TRUE,\n 'not null' => TRUE,\n ],\n 'token' => [\n 'description' => \"A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.\",\n 'type' => 'varchar_ascii',\n 'length' => 64,\n 'not null' => TRUE,\n ],\n 'timestamp' => [\n 'description' => 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.',\n 'type' => 'int',\n 'not null' => TRUE,\n ],\n 'batch' => [\n 'description' => 'A serialized array containing the processing data for the batch.',\n 'type' => 'blob',\n 'not null' => FALSE,\n 'size' => 'big',\n ],\n ],\n 'primary key' => ['bid'],\n 'indexes' => [\n 'token' => ['token'],\n ],\n ];\n }", "public function getBatch()\n\t{\n\t\tif (! is_int(self::$batch))\n\t\t{\n\t\t\t$batch = $this->db->table($this->table)\n\t\t\t\t->selectMax('batch')\n\t\t\t\t->get()->getResultObject();\n\t\t\t$batch = empty($batch) ? 0 : (int) reset($batch)->batch;\n\n\t\t\tself::$batch = $batch + 1;\n\t\t}\n\n\t\treturn self::$batch;\n\t}", "public function setBatch($value)\n {\n $this->_batch = $value;\n return $this;\n }", "public function setBatch(Batch $batch)\n {\n $this->batch = $batch;\n }", "function get_batch($batch_id)\n {\n return $this->db->get_where('batch',array('batch_id'=>$batch_id))->row_array();\n }", "function delete_batch($batch_id)\n {\n return $this->db->delete('batch',array('batch_id'=>$batch_id));\n }", "protected function getBatchCacheKey(ObjectIdentityInterface $oid)\n {\n return $oid->getType() . '_' . $this->getBatchNumber($oid);\n }", "public function get_end_batch(): string\n {\n return $this->end_batch;\n }", "public function __construct(array $batch)\n\t{\n\t\tif(Tivoka::$version == Tivoka::VER_1_0) throw new Tivoka_exception('Batch requests are not supported by JSON-RPC 1.0 spec', Tivoka::ERR_SPEC_INCOMPATIBLE);\n\t\t$this->id = array();\n\t\n\t\t//prepare requests...\n\t\tforeach($batch as $request)\n\t\t{\n\t\t\tif(!($request instanceof Tivoka_Request) && !($request instanceof Tivoka_Notification))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t//request...\n\t\t\tif($request instanceof Tivoka_Request)\n\t\t\t{\n\t\t\t\tif(in_array($request->id,$this->id,true)) continue;\n\t\t\t\t$this->id[$request->id] = $request;\n\t\t\t}\n\t\t\t\n\t\t\t$this->request[] = $request->request;\n\t\t}\n\t}", "public function getOrCreateBatch()\n {\n $batch = DB::table('job_batches')->where('name', '=', 'Process Csv')->first();\n if (!$batch) {\n try {\n return Bus::batch([])->name('Process Csv')->dispatch();\n } catch (\\Throwable $e) {\n }\n }\n return Bus::findBatch($batch->id);\n }", "public function requestBatchSatus($batchId);" ]
[ "0.7600266", "0.7507258", "0.7207866", "0.673229", "0.64077014", "0.63488173", "0.59483385", "0.5812637", "0.5812263", "0.57884437", "0.5721678", "0.55684054", "0.55529034", "0.5532456", "0.5518264", "0.53182745", "0.5309306", "0.52660006", "0.5252119", "0.5234759", "0.52215296", "0.5219741", "0.52054435", "0.5191854", "0.5188026", "0.5175262", "0.5162866", "0.5149966", "0.5141714", "0.51292866" ]
0.75942975
1
Generated from protobuf field repeated .kubemq.SendQueueMessageResult Results = 2;
public function setResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Kubemq\SendQueueMessageResult::class); $this->Results = $arr; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function send(){\n\t\t\n\t\t$database = new Database();\n\t\t$query = $database->selectOne('message_queues', array('id',\n\t\t\t\t\t\t\t\t\t 'is_executed','executed_at','message','cellphone'), \n\t\t\t\t\t\t\t\t\t ' is_executed=0 ');\n\t\t$exec = $database->query($query);\n\t\tif ($exec) {\n\t\t\t$record = $database->fetchArray($exec);\n\t\t\t$response = $this->sendMessage($database, $record);\n\n\t\t\treturn json_encode(array('status' => $response['status'], 'message' => $response['message']));\n\t\t}\n\n\t}", "public function getResultMessage() {}", "public function testSendInvoiceToBatchOnSendMessageBatchCallable()\n {\n $validator = new InvoiceValidator();\n $successInvoice = Invoice::load($this->getValidInvoiceData()[0], $validator);\n $failedInvoice = Invoice::load($this->getValidInvoiceData()[1], $validator);\n\n $results = [\n # Result for GetQueueUrl command\n new Result(['QueueUrl' => 'my-queue-url']),\n # Result for SendMessageBatch command for first batch of 10\n new Result([\n 'Successful' => [0 => ['Id' => $successInvoice->getInvoiceId()]],\n 'Failed' => [0 => ['Id' => $failedInvoice->getInvoiceId()]]\n ])\n ];\n\n $sqsQueue = $this->getSqsQueueInstance($results);\n\n # Use SqsQueueCallbackTester to test the callback\n $callbackTester = new SqsQueueCallbackTester();\n $sqsQueue->setOnSendMessageBatchCallback($callbackTester);\n\n $sqsQueue\n ->sendInvoiceToBatch($successInvoice, $validator)\n ->sendInvoiceToBatch($failedInvoice, $validator);\n\n # Destroy the object. This should trigger the final batch send.\n unset($sqsQueue);\n\n # Confirm that the successful and failed invoices were passed to the\n # SqsQueueCallbackTester instance\n $this->assertEquals(1, count($callbackTester->successfulInvoices));\n $this->assertEquals($successInvoice, $callbackTester->successfulInvoices[0]);\n $this->assertEquals(1, count($callbackTester->failedInvoices));\n $this->assertEquals($failedInvoice, $callbackTester->failedInvoices[0]);\n\n # Confirm the stack is empty (ie. that the API calls HAVE been made)\n $this->assertEquals(0, $this->getAwsMockHandlerStackCount());\n }", "protected function queueMessages()\n {\n $pages = $users = $files = $sites = 0;\n\n foreach ($this->pagesToQueue() as $id) {\n yield \"P{$id}\";\n $pages++;\n }\n foreach ($this->pagesToRemove() as $id) {\n yield \"RP{$id}\";\n $pages++;\n }\n foreach ($this->usersToRemove() as $id) {\n yield \"RU{$id}\";\n $users++;\n }\n foreach ($this->filesToRemove() as $id) {\n yield \"RF{$id}\";\n $files++;\n }\n foreach ($this->sitesToRemove() as $id) {\n yield \"RS{$id}\";\n $sites++;\n }\n\n yield 'R' . json_encode([$pages, $users, $files, $sites]);\n }", "public function process_queue()\r\n {\r\n error_reporting(0);\r\n\r\n // TODO: Prefill information is stored in this array. It's nasty, but it works for now.\r\n // This will need to be cleaned up somehow, later.\r\n $this->prefillRequests = array();\r\n\r\n $this->parseResponses();\r\n\r\n // Array of keys that need to be included in the response.\r\n $include = array('request', 'class', 'hit');\r\n $responseQuery = [];\r\n foreach($this->messageQuery as $response) {\r\n // Switch all keys to lower case to prevent possible case errors.\r\n $responseArr = array_change_key_case($response, CASE_LOWER);\r\n // returns an array that intersects with the keys from the $include array\r\n $responseQuery[] = array_intersect_key($responseArr, array_flip($include));\r\n }\r\n\r\n $requestSummary = $this->ArchiveResponse->ArchiveRequest->Request->getSummary(\r\n $this->CurrentAgency->agencyId,\r\n $this->CurrentDevice->agencyDeviceId);\r\n\r\n $summary = array(\r\n 'requests' => $requestSummary,\r\n 'response' => $responseQuery,\r\n 'prefill' => $this->prefillRequests\r\n );\r\n $this->set('summary', $summary);\r\n }", "public function enqueueRequests()\n {\n if (!$this->has_requests) {\n\t\treturn \"No requests to send\";\n\t}\n\t\n\t$finished = \"Error connecting to redis\";\n \n try {\n $redis = new Redis();\n $redis->pconnect(REDIS_ADDRESS);\n \n $multi = $redis->multi();\n \n //Executing all posts to Redis in one multi batch\n foreach ($this->data_requests as $key => $request) {\n $uuid = $request->getUUID();\n \n $multi->lPush(PENDING_QUEUE, $uuid);\n $multi->hSet(VALUES_HASH, $uuid, $request->getFormattedURL());\n $multi->hSet(VALUES_HASH, $uuid . ':method', $this->endpoint->method);\n $multi->hSet(STATS_HASH, $uuid . ':start', $this->start_time);\n }\n \n $ret = $multi->exec();\n \n $finished = \"Postback Delivered\";\n \n //Seach results for any errors from Redis commands\n foreach ($ret as $idx => $result) {\n if (!$result) {\n $finished = \"Redis call failed: \" . $idx;\n }\n }\n \n }\n catch (Exception $e) {\n return \"Error posting to Redis\";\n }\n \n return $finished;\n \n }", "function execute() {\n foreach($this -> queue as $queue) {\n for($written = 0; $written < strlen($queue); $written += $fwrite) {\n $fwrite = fwrite($this -> __sock, substr($queue, $written));\n if($fwrite === false or $fwrite <= 0)\n trigger_error('WRITE ERROR', E_USER_ERROR);\n }\n }\n // Read in the results from the pipelined commands\n $responses = array();\n for($i = 0; $i < count($this -> queue); $i++) {\n $responses[] = $this -> response();\n }\n // Clear the queue and return the response\n $this -> queue = array();\n if($this -> pipelined) {\n $this -> pipelined = false;\n return $responses;\n }\n return $responses[0];\n }", "public function transactionMessage ($resultsArr);", "public function batchSendQueue(\n Swift_Mime_Message $message,\n &$failedRecipients = null,\n Swift_Mailer_RecipientIterator $it = null\n )\n {\n $this->addToQueue = true;\n \n return $this->batchSend($message, $failedRecipients, $it);\n }", "public function execute()\n {\n\n $undeliveredRecipients = array();\n $recipientsCount = 0;\n\n while (count($this->recipients) >= 1) {\n\n //send the command and read the response\n parent::execute();\n\n $recipient = array_pop($this->recipients);\n\n switch ($this->response->getCode()) {\n\n case '250':\n case '251':\n if (isset($recipient['original_email'])) {\n //we finally delivered mail to a user that provided a \n //forward-address\n $key = array_search($recipient['original_email'],\n $undeliveredRecipients);\n\n if ($key !== FALSE)\n unset($undeliveredRecipients[$key]);\n }\n\n $recipientsCount++;\n break;\n\n case '450':\n case '451':\n //add the recipient to the begginning of the queue to try again\n //later\n if ($recipient['retries'] > 0) {\n $recipient['retries']--;\n array_unshift($this->recipients, $recipient);\n }\n break;\n\n /* Handle too much recipients by splitting the message to chunks\n *\n * RFC 821 [30] incorrectly listed the error where an SMTP server\n * exhausts its implementation limit on the number of RCPT commands\n * (\"too many recipients\") as having reply code 552. The correct \n * reply code for this condition is 452. Clients SHOULD treat a \n * 552 code in this case as a temporary, rather than permanent, \n * failure so the logic below works. \n */\n case '452':\n case '552':\n array_push($this->recipients, $recipient);\n\n $result['undelivered'] = $undeliveredRecipients;\n //this causes the client to append a new mail sending sequence \n //for the rest of recipients\n $result['toDeliver'] = $this->recipients;\n $result['recipientsCount'] = $recipientsCount;\n\n return $result;\n break; //unreachable\n\n case '550':\n case '553':\n $undeliveredRecipients[] = $recipient['email'];\n break;\n\n case '551':\n if (preg_match('/<\\([^>]*\\)>/', $this->response, $matches)) {\n\n $forward = array();\n $forward['email'] = $matches[1];\n $forward['retries'] = 2;\n if (isset($recipient['original_email'])) {\n $forward['original_email'] = \n $recipient['original_email'];\n } else {\n $forward['original_email'] = $recipient['email'];\n $undeliveredRecipients[] = $recipient['email'];\n }\n\n $this->recipients[] = $forward;\n }\n break;\n }\n\n }\n\n return array(\n 'undelivered' => $undeliveredRecipients, \n 'recipientsCount' => $recipientsCount,\n );\n }", "public function queue($numbers = null, $message = null, $type = null, $queue = null);", "public function testSendInvoiceToBatchSuccessfulSendViaSendThreshold()\n {\n $validator = new InvoiceValidator();\n $invoice = Invoice::load($this->getValidInvoiceData()[0], $validator);\n\n $results = [\n # Result for GetQueueUrl command\n new Result(['QueueUrl' => 'my-queue-url']),\n # Result for SendMessageBatch command for first batch of 10\n new Result([]),\n # Result for SendMessageBatch command for the final batch of 1\n new Result([])\n ];\n\n $sqsQueue = $this->getSqsQueueInstance($results);\n\n for ($i = 0; $i < (SqsQueue::SEND_BATCH_SIZE + 1); $i++) {\n $invoice->setInvoiceId($invoice->getInvoiceId() . '-' . $i);\n $sqsQueue->sendInvoiceToBatch($invoice, $validator);\n }\n\n # Destroy the object. This should trigger the final batch send.\n unset($sqsQueue);\n\n # Confirm the stack is empty (ie. that the API calls HAVE been made)\n $this->assertEquals(0, $this->getAwsMockHandlerStackCount());\n }", "public function testGetWebhookQueueAccountMessage()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhookQueueAccountMessage(), 3);\n\n $webhook = $sw->getWebhookQueueAccountMessage();\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueAccountMessage(false);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $webhook = $sw->getWebhookQueueAccountMessage(true);\n $this->assertInstanceOf(SmartwaiverWebhookMessage::class, $webhook);\n\n $this->checkGetRequests($container, [\n '/v4/webhooks/queues/account?delete=false',\n '/v4/webhooks/queues/account?delete=false',\n '/v4/webhooks/queues/account?delete=true'\n ]);\n }", "public function Queues();", "public function queueOn($queue, $numbers = null, $message = null, $type = null);", "public function sendMultiple(array $messages);", "function exec_queue()\n\t{\n\t\t$vbulletin =& $this->registry;\n\n\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t{\n\t\t\t// Lock mailqueue table so that only one process can\n\t\t\t// send a batch of emails and then delete them\n\t\t\t$vbulletin->db->lock_tables(array('mailqueue' => 'WRITE'));\n\t\t}\n\n\t\t$emails = $vbulletin->db->query_read(\"\n\t\t\tSELECT *\n\t\t\tFROM \" . TABLE_PREFIX . \"mailqueue\n\t\t\tORDER BY mailqueueid\n\t\t\tLIMIT \" . intval($vbulletin->options['emailsendnum'])\n\t\t);\n\n\t\t$mailqueueids = '';\n\t\t$newmail = 0;\n\t\t$emailarray = array();\n\t\twhile ($email = $vbulletin->db->fetch_array($emails))\n\t\t{\n\t\t\t// count up number of mails about to send\n\t\t\t$mailqueueids .= ',' . $email['mailqueueid'];\n\t\t\t$newmail++;\n\t\t\t$emailarray[] = $email;\n\t\t}\n\t\tif (!empty($mailqueueids))\n\t\t{\n\t\t\t// remove mails from queue - to stop duplicates being sent\n\t\t\t$vbulletin->db->query_write(\"\n\t\t\t\tDELETE FROM \" . TABLE_PREFIX . \"mailqueue\n\t\t\t\tWHERE mailqueueid IN (0 $mailqueueids)\n\t\t\t\");\n\n\t\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t\t{\n\t\t\t\t$vbulletin->db->unlock_tables();\n\t\t\t}\n\n\t\t\tif ($vbulletin->options['use_smtp'])\n\t\t\t{\n\t\t\t\t$prototype =& new vB_SmtpMail($vbulletin);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$prototype =& new vB_Mail($vbulletin);\n\t\t\t}\n\n\t\t\tforeach ($emailarray AS $index => $email)\n\t\t\t{\n\t\t\t\t// send those mails\n\t\t\t\t$mail = (phpversion() < '5' ? $prototype : clone($prototype)); // avoid ctor overhead\n\t\t\t\t$mail->quick_set($email['toemail'], $email['subject'], $email['message'], $email['header'], $email['fromemail']);\n\t\t\t\t$mail->send();\n\t\t\t}\n\n\t\t\t$newmail = 'data - ' . intval($newmail);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($vbulletin->options['usemailqueue'] == 2)\n\t\t\t{\n\t\t\t\t$vbulletin->db->unlock_tables();\n\t\t\t}\n\n\t\t\t$newmail = 0;\n\t\t}\n\n\t\t// update number of mails remaining\n\t\t$vbulletin->db->query_write(\"\n\t\t\tUPDATE \" . TABLE_PREFIX . \"datastore SET\n\t\t\t\tdata = \" . $newmail . \",\n\t\t\t\tdata = IF(data < 0, 0, data)\n\t\t\tWHERE title = 'mailqueue'\n\t\t\");\n\n\t\t// if we're using a alternate datastore, we need to give it an integer value\n\t\t// this may not be atomic\n\t\tif (method_exists($vbulletin->datastore, 'build'))\n\t\t{\n\t\t\t$mailqueue_db = $vbulletin->db->query_first(\"\n\t\t\t\tSELECT data\n\t\t\t\tFROM \" . TABLE_PREFIX . \"datastore\n\t\t\t\tWHERE title = 'mailqueue'\n\t\t\t\");\n\t\t\t$vbulletin->datastore->build('mailqueue', intval($mailqueue_db['data']));\n\t\t}\n\t}", "public function sendQueue(Swift_Mime_Message $message, &$failedRecipients = null)\n {\n $this->addToQueue = true;\n \n return $this->send($message, $failedRecipients);\n }", "public function runQueue();", "public function queue() {\n\t\t$this->prepareMessage();\n\t\t$this->queueRepository->add($this->toArray());\n\t}", "public function sendResults( $results = array() ) {\n\n // dummy data:\n // $results = array(\n // (object)array(\n // \"id\" => \"484848484852bf4f6c7eca896c0030516ab2f228f157237712e52d66489d9960\",\n // \"result\" => 6,\n // \"sc\" => 1625125748\n // )\n // );\n\n $postdata = json_encode(\n (object)array(\n 'testResults' => $results\n )\n );\n\n $ch = curl_init();\n\n $curlOpts = array(\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postdata,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_SSLKEY => self::$keyFile,\n CURLOPT_SSLCERT => self::$certFile,\n CURLOPT_KEYPASSWD => self::$keyPass,\n CURLOPT_URL => self::getStageURL() . self::API_ENDPOINT_RESULTS,\n CURLOPT_HTTPHEADER => array('Content-Type: application/json'),\n );\n \n curl_setopt_array($ch , $curlOpts);\n \n $output = curl_exec( $ch ) ;\n \n if ( curl_errno( $ch ) ) {\n $error_msg = curl_error( $ch );\n print \"curl_error: $error_msg <br>\";\n } else {\n $status = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n if ( 204 === $status ) {\n return true;\n } else {\n $response = json_decode($output);\n if ( is_object( $response ) ) {\n return $response;\n } else {\n return (object)array(\n 'status' => $status,\n 'response' => $response\n );\n }\n }\n }\n }", "public function testMessageThreadsV2GetMessages0()\n {\n }", "public function testGetQueueUrlQueueCreated()\n {\n $queueUrl = 'my-invoice-queue-message-url';\n $results = [\n new Result(['QueueUrl' => $queueUrl])\n ];\n $sqsQueue = $this->getSqsQueueInstance($results);\n $this->assertEquals($queueUrl, $sqsQueue->getQueueUrl());\n $this->assertEquals(0, $this->getAwsMockHandlerStackCount());\n }", "public function getMessageQueue()\n\t{\n\t\treturn $this->messages;\n\t}", "private function setQueue() {\n if (count($this->request->q) > 0) {\n try {\n $this->client->setQueue(array($this->request->q));\n $this->view->addParameter(\"result\", \"success\");\n } catch(Exception $e) {\n $this->view->addParameter(\"result\", \"failure\");\n $this->view->addParameter(\"data\", \"Failed to execute '{$this->request->action}' action\");\n }\n } else {\n $this->view->addParameter(\"result\", \"invalid\");\n $this->view->addParameter(\"data\", \"Query array must not be empty\");\n }\n }", "public function queued()\n {\n return $this->memory->get('orchestra.publisher.queue', []);\n }", "public function send( Execution $e ) {\n $this->queue[] = $e;\n $this->messagesAccepted++;\n }", "public function testEnqueueQueueJobs()\n {\n $queueJobTest1 = new TestQueueJob('price', 'ShopwarePriceImport');\n $queueJobTest2 = new TestQueueJob('product', 'ShopwareProductExport');\n\n $result = $this->queue->enqueue($queueJobTest1);\n $this->assertTrue($result);\n\n $result = $this->queue->enqueue($queueJobTest2);\n $this->assertTrue($result);\n\n $this->assertCount(2, $this->queueStorage->queue);\n }", "function getResultMessage() {\n return $this->memcached->getResultCode();\n }", "public function getQueuedPendingCount()\n {\n return $this->queuedPendingCount;\n }" ]
[ "0.6040951", "0.56192476", "0.5537163", "0.55119437", "0.5408537", "0.53977305", "0.53054947", "0.5264364", "0.5251886", "0.5233471", "0.5219818", "0.5163005", "0.5141143", "0.5122098", "0.5097336", "0.50799805", "0.50676286", "0.5051978", "0.50303143", "0.49821743", "0.49724948", "0.496063", "0.49496973", "0.4945617", "0.4938601", "0.49367458", "0.49351364", "0.49200755", "0.49051932", "0.49038368" ]
0.76263034
0
Get the value of Codigo Producto
public function getCodigoProducto() { return $this->codigoProducto; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCodigoProducto()\n {\n return $this->CodigoProducto;\n }", "public function getCodProducto()\n {\n return $this->codProducto;\n }", "public function getProducte()\n {\n return $this->producte;\n }", "public function getOneProducto()\n {\n $sql = \"SELECT * FROM productos WHERE id = {$this->getId()}\";\n $query = $this->conexion->query($sql);\n\n if ($query == true) {\n\n $resultado = $query->fetch_object();\n return $resultado;\n }\n }", "public function getIdProducto()\n {\n return $this->idProducto;\n }", "public function getProduct();", "public function getProducto(){\n $sql='SELECT idProducto, nombre, precio, descripcion, foto, estado, idCategoria, cantidad, idProveedor from producto WHERE idProducto = ?';\n $params=array($this->id);\n return Database::getRow($sql,$params);\n }", "public function getIdProducto()\n {\n return $this->id_producto;\n }", "public function getIdProducto()\n {\n return $this->id_producto;\n }", "public function CodigoProducto()\n\t{\n\t\tself::SetNames();\n\n\t\t$sql = \" select codproducto from productos order by codproducto desc limit 1\";\n\t\tforeach ($this->dbh->query($sql) as $row){\n\n\t\t\t$codproducto[\"codproducto\"]=$row[\"codproducto\"];\n\n\t\t}\n\t\tif(empty($codproducto[\"codproducto\"]))\n\t\t{\n\t\t\techo $nro = '00001';\n\n\t\t} else\n\t\t{\n\t\t\t$resto = substr($codproducto[\"codproducto\"], 0, -0);\n\t\t\t$coun = strlen($resto);\n\t\t\t$num = substr($codproducto[\"codproducto\"] , $coun);\n\t\t\t$dig = $num + 1;\n\t\t\t$codigo = str_pad($dig, 5, \"0\", STR_PAD_LEFT);\n\t\t\techo $nro = $codigo;\n\t\t}\n\t}", "public function findValueProd($id){\n return Product::where('id',$id)->first()->value;\n }", "function getId_Producto(){\r\n\t\treturn $this->nId_Producto;\r\n\t}", "public function getProductValueById()\n\t{\n\t\t$product_id = $this->input->post('product_id');\n\t\tif ($product_id) {\n\t\t\t$product_data = $this->model_products->getProductData($product_id);\n\t\t\techo json_encode($product_data);\n\t\t}\n\t}", "public function getIdProducto()\n {\n return $this->idProducto;\n }", "function obtenerProducto($codProducto){\n\t\t$x = $this->pdo->prepare('SELECT * FROM producto where codProducto = ?');\n\t\t$x->execute(array($codProducto));\n\t\treturn $x->fetchALL(PDO::FETCH_OBJ);\n\t}", "public function getId_produto()\n {\n return $this->id_produto;\n }", "public function GetIdProducto()\n\t{\n\t\treturn $this->idProd;\n\t}", "public function getProduct_code () {\n\t$preValue = $this->preGetValue(\"product_code\"); \n\tif($preValue !== null && !\\Pimcore::inAdmin()) { \n\t\treturn $preValue;\n\t}\n\t$data = $this->product_code;\n\treturn $data;\n}", "public function getProduct() {\n return $this->getValueOrDefault('Product');\n }", "public function getNombreProducto()\n {\n return $this->nombreProducto;\n }", "public function getId_producto()\n {\n return $this->id_producto;\n }", "public function getProduct()\n\t{\n\t\treturn $this->getKeyValue('product'); \n\n\t}", "public function getIdproducto()\n {\n return $this->idproducto;\n }", "function getIdkitprodutos() {\n return $this->idkitprodutos;\n }", "public function getIdproducto()\n {\n return $this->idproducto;\n }", "public function getProductId(): string;", "public function getProducto($codigo) {\r\n $pdo = Database::connect();\r\n $sql = \"select * from producto where codigo=?\";\r\n $consulta = $pdo->prepare($sql);\r\n $consulta->execute(array($codigo));\r\n //obtenemos el objeto especifico:\r\n $res=$consulta->fetch(PDO::FETCH_ASSOC);\r\n $producto=new Producto($res['codigo'], $res['descripcion'], $res['cantidad'], $res['precio']);\r\n Database::disconnect();\r\n //retornamos el objeto encontrado:\r\n return $producto;\r\n }", "function getNombreProducto()\n {\n return $this->NombreProducto;\n }", "function getProductCode()\n {\n return $this->productCode;\n }", "public function getProd_niche () {\n\t$preValue = $this->preGetValue(\"prod_niche\"); \n\tif($preValue !== null && !\\Pimcore::inAdmin()) { \n\t\treturn $preValue;\n\t}\n\t$data = $this->getClass()->getFieldDefinition(\"prod_niche\")->preGetData($this);\n\treturn $data;\n}" ]
[ "0.7543214", "0.7257408", "0.7175672", "0.7009522", "0.70019805", "0.6991427", "0.69376636", "0.6918813", "0.6918813", "0.68695515", "0.68563527", "0.6836596", "0.68336266", "0.68281275", "0.6752512", "0.674717", "0.67102736", "0.6692392", "0.6653594", "0.6647063", "0.66326326", "0.66231245", "0.66194767", "0.6601732", "0.6587074", "0.6575255", "0.65557647", "0.65480834", "0.6522362", "0.6517589" ]
0.7268723
1
Gets the transaction_history (and agent first/last name) for a single transaction
public function getHistory($transaction_id) { $query = "SELECT h.*, a.name_last, a.name_first FROM transaction_history h JOIN agent a on a.agent_id = h.agent_id WHERE h.transaction_id = ? ORDER BY h.date_created DESC"; $result = DB_Util_1::queryPrepared( $this->db, $query, array( $transaction_id, ) ); return $result->fetchAll(PDO::FETCH_OBJ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getCallsLogByTransaction($transaction_id) {\r\r\n $criteria = new CDbCriteria;\r\r\n $criteria->compare('t.transaction_id', $transaction_id);\r\r\n $criteria->compare('t.status', STATUS_ACTIVE);\r\r\n $criteria->order = 'date ASC';\r\r\n\r\r\n $models = self::model()->findAll($criteria);\r\r\n if ($models) {\r\r\n return $models;\r\r\n }\r\r\n return;\r\r\n }", "public function getTransactions();", "public function getTransactionDetails(array &$transaction) {\n\t\t$transactionIds = $this->find('transactions', array(\n\t\t\t'transaction_id' => Hash::extract($transaction['orders'], '{n}.transaction_id')\n\t\t));\n\t\tif (empty($transactionIds)) {\n\t\t\treturn;\n\t\t}\n\t\t$transactionIds = array_flip($transactionIds);\n\t\tforeach ($transaction['orders'] as &$order) {\n\t\t\t$order['infinitas_payment_log_id'] = $transactionIds[$order['transaction_id']];\n\t\t}\n\t}", "function getAllTransactions()\n {\n $transactions = $this->all();\n\n /* Add additional attributes to each Stock */\n foreach ($transactions as $transaction)\n {\n // Add a link to each stock's history page\n $transaction->href = '/transaction/' . $transaction->DateTime;\n }\n\n return $transactions;\n }", "public function getTransactionInfos() {\n return $this->transactionInfos;\n }", "public function getTransaction();", "abstract protected function getTransactions();", "public function getTransactions()\r\n {\r\n return $this->transactions;\r\n }", "public function getTransactions()\r\n {\r\n return $this->transactions;\r\n }", "public function getTransactions()\r\n {\r\n return $this->transactions;\r\n }", "public function getTransactions()\n {\n return $this->transactions;\n }", "public function getTransactions()\n\t{\n\t\treturn $this->data['transactions'];\n\t}", "public function getMyTransactionHistory($patron, $params)\n {\n $pageSize = $params['limit'] ?? 50;\n $offset = isset($params['page']) ? ($params['page'] - 1) * $pageSize : 0;\n $sortOrder = isset($params['sort']) && 'checkout asc' === $params['sort']\n ? 'asc' : 'desc';\n $result = $this->makeRequest(\n ['v3', 'patrons', $patron['id'], 'checkouts', 'history'],\n [\n 'limit' => $pageSize,\n 'offset' => $offset,\n 'sortField' => 'outDate',\n 'sortOrder' => $sortOrder,\n 'fields' => 'item,outDate'\n ],\n 'GET',\n $patron\n );\n if (isset($result['code'])) {\n return [\n 'success' => false,\n 'status' => 146 === $result['code']\n ? 'ils_transaction_history_disabled'\n : 'ils_connection_failed'\n ];\n }\n $transactions = [];\n foreach ($result['entries'] as $entry) {\n $transaction = [\n 'id' => '',\n 'item_id' => $this->extractId($entry['item']),\n 'checkoutDate' => $this->dateConverter->convertToDisplayDate(\n 'Y-m-d', $entry['outDate']\n )\n ];\n // Fetch item information\n $item = $this->makeRequest(\n ['v3', 'items', $transaction['item_id']],\n ['fields' => 'bibIds,varFields'],\n 'GET',\n $patron\n );\n $transaction['volume'] = $this->extractVolume($item);\n if (!empty($item['bibIds'])) {\n $transaction['id'] = $item['bibIds'][0];\n\n // Fetch bib information\n $bib = $this->getBibRecord(\n $transaction['id'], 'title,publishYear', $patron\n );\n if (!empty($bib['title'])) {\n $transaction['title'] = $bib['title'];\n }\n if (!empty($bib['publishYear'])) {\n $transaction['publication_year'] = $bib['publishYear'];\n }\n }\n $transactions[] = $transaction;\n }\n\n return [\n 'count' => $result['total'] ?? 0,\n 'transactions' => $transactions\n ];\n }", "public function getTransactions() {\n\t\treturn $this->transactions;\n\t}", "public function getTransactionByHistory($query)\n {\n $granularity = $this->getGranularity($query['startDate'], $query['endDate']);\n if($granularity == 'month') {\n $dateQuery = 'to_char(orders.created_at, \\'YYYY-MM\\') as date';\n $dateGroupBy = array('date');\n $dateOrder = 'date asc';\n } else if($granularity == 'day') {\n $dateQuery = 'to_char(orders.created_at, \\'YYYY-MM-DD\\') as date';\n $dateGroupBy = array('date');\n $dateOrder = 'date asc';\n }\n\n DB::enableQueryLog();\n // execute\n $transaction = DB::connection('virtual_market')\n ->table('orders')\n ->join('order_statuses', 'orders.order_status', '=', 'order_statuses.id')\n ->select(DB::raw($query['aggregate'].'as value, count(*),'.$dateQuery))\n ->where('orders.created_at', '>=', $query['startDate'])\n ->where('orders.created_at', '<=', $query['endDate'])\n ->where('status', '=', $this->successStatus)\n ->whereIn('order_statuses.name', [$this->successName])\n ->groupBy($dateGroupBy)\n ->orderByRaw($dateOrder)\n // ->toSql();\n ->get();\n // dd ($data);\n\n $data = array();\n $data['granularity'] = $granularity;\n $data['transaction'] = $transaction;\n $status = $this->setStatus();\n\n return response()->json([\n 'status' => $status,\n 'data' => $data\n ]);\n }", "public function getTransactionByHistory($query)\n {\n $granularity = $this->getGranularity($query['startDate'], $query['endDate']);\n if($granularity == 'month') {\n $dateQuery = 'to_char(orderlines.created_at, \\'YYYY-MM\\') as date';\n $dateGroupBy = array('date');\n $dateOrder = 'date asc';\n } else if($granularity == 'day') {\n $dateQuery = 'to_char(orderlines.created_at, \\'YYYY-MM-DD\\') as date';\n $dateGroupBy = array('date');\n $dateOrder = 'date asc';\n }\n\n DB::enableQueryLog();\n // execute\n $transaction = DB::connection('marketplace')\n ->table('orderlines')\n ->join('orderline_statuses','orderlines.orderline_status_id','orderline_statuses.id')\n ->select(DB::raw($query['aggregate'].'as value, count(*),'.$dateQuery))\n ->where('orderlines.created_at', '>=', $query['startDate'])\n ->where('orderlines.created_at', '<=', $query['endDate'])\n ->where('orderline_statuses.name', '=', $this->successStatus)\n ->groupBy($dateGroupBy)\n ->orderByRaw($dateOrder)\n // ->toSql();\n ->get();\n // dd ($data);\n\n $data = array();\n $data['granularity'] = $granularity;\n $data['transaction'] = $transaction;\n $status = $this->setStatus();\n\n return response()->json([\n 'status' => $status,\n 'data' => $data\n ]);\n }", "public function getAccountTransactionHistory($accountNumber) {\n $stmt = $this->conn->stmt_init ();\n $stmt->prepare ( \"call getAccountTransactionHistory (?)\" );\n $stmt->bind_param ( 's', $accountNumber );\n $stmt->execute ();\n \n return $stmt->get_result ();\n }", "public function getAll()\n {\n return $this->transactions;\n }", "public function gettransaction($transaction){\n return $this->bitcoin->gettransaction($transaction);\n }", "public function get_transaction_backtrace() {\n\t\tif (!$this->debug_enabled) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn isset($this->debug_log['transactions']) ? $this->debug_log['transactions'] : [];\n\t}", "public function transaction()\n {\n return $this->hasMany(Transaction::class, 'transaction_detailID');\n }", "public function getPaymentHistory(){\r\n\t\t$result = array();\r\n\t\treturn $result;\r\n\t}", "public static function getTransaction()\n {\n $query = new Query;\n return $query->select([ 'c.*', 'u.username', 'u.email','t.transaction_id', 't.transaction_amount',\n 't.payment_date as tn_payment_date'])\n ->from('contest as c')\n ->LeftJoin('transaction_details as t', 't.contest_id=c.id')\n ->LeftJoin('user as u', 'u.id=c.user_id')\n ->orderBy(['t.payment_date' => SORT_DESC]); \n }", "public function transaction()\n {\n return $this->hasMany('App\\Transaction');\n }", "public function transactions()\n {\n return $this->hasMany(Transaction::class);\n }", "public function transactions()\n {\n return $this->hasMany(Transaction::class);\n }", "public function transactionDetails()\n {\n return $this->hasMany(TransactionDetail::class);\n }", "function get_history() {\n\t\treturn $this->history;\n\t}", "public function getTransactionLog()\n {\n if($this->transactionLog==null)\n {\n $this->transactionLog = new TransactionLog();\n }\n return $this->transactionLog;\n }", "public function getTransaction($txid);" ]
[ "0.65027875", "0.6466763", "0.625794", "0.62398183", "0.62250084", "0.61974525", "0.6170981", "0.6164785", "0.6164785", "0.6164785", "0.6151405", "0.6137095", "0.61225694", "0.6108571", "0.60953087", "0.60938996", "0.60662717", "0.60387385", "0.60361505", "0.6023784", "0.59762645", "0.59676105", "0.5947411", "0.59410393", "0.5917588", "0.5917588", "0.58916724", "0.58916473", "0.58684725", "0.5866031" ]
0.7644228
0
Will store the factory to self.
public function testWillStoreTheFactoryToSelf() { $this->controller = new Controller($this->service, $this->factory); static::assertSame( $this->factory, \PHPUnit_Framework_Assert::readAttribute($this->controller, "factory") ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "final protected function setFactory($factory){\n\t\t\t$this->factory = $factory;\n\t\t}", "public function getFactory()\n {\n return $this->_factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function getFactory()\n {\n return $this->factory;\n }", "public function add_factory() {\n $this->factorycount++;\n }", "public function getFactory() {}", "public static function setFactory(/*ECash_Factory*/ $factory)\n\t{\n\t\tself::$factory = $factory;\n\t}", "private function registerFactoryInRepository(): FactoryInterface\n {\n if (!empty($this->statedClassName)) {\n $this->factoryRepository[$this->statedClassName] = $this;\n }\n\n return $this;\n }", "protected static function newFactory()\n {\n //\n }", "protected function saveFactoryState()\n\t{\n\t\t$this->savedFactoryState['application'] = JFactory :: $application;\n\t\t$this->savedFactoryState['config'] = JFactory :: $config;\n\t\t$this->savedFactoryState['session'] = JFactory :: $session;\n\t\t$this->savedFactoryState['language'] = JFactory :: $language;\n\t\t$this->savedFactoryState['document'] = JFactory :: $document;\n\t\t$this->savedFactoryState['acl'] = JFactory :: $acl;\n\t\t$this->savedFactoryState['database'] = JFactory::$database;\n\t\t$this->savedFactoryState['mailer'] = JFactory :: $mailer;\n\t\t$this->savedFactoryState['shconfig'] = SHFactory::$config;\n\t\t$this->savedFactoryState['shdispatcher'] = SHFactory::$dispatcher;\n\t}", "public function getFactory(): Factory;", "public function loadFactory()\n {\n $this->di = new Di\\FactoryDefault;\n\n return $this;\n }", "public function make($factory);", "public function __construct()\n {\n $this->factories = [];\n }", "public static function getFactory()\r\n\t{\r\n\t\treturn self::$factory;\r\n\t}", "public function setFactory($factory)\n\t{\n\t\t$this->factory = $factory;\n\t\t\n\t\treturn $this;\n\t}", "public function getFactory()\n {\n return new Factory();\n }", "public static function setFactoryFunction( $factory ) \n\t{\n\t\tself::$factory = $factory;\n\t}", "public function store()\n {\n return $this->create();\n }", "function storeAndNew() {\n $this->store();\n }", "public function testFactoryReturnsAnIndividualInstance()\n\t{\n\t\t$instance = Dispatcher::instance();\n\n\t\t$factory = Dispatcher::factory();\n\n\t\t$this->assertNotSame($factory, $instance);\n\t}", "protected function registerFactory()\n {\n $this->app->singleton('freshdesk.factory', function () {\n return new FreshdeskFactory();\n });\n $this->app->alias('freshdesk.factory', FreshdeskFactory::class);\n }", "protected static function newFactory()\n {\n return PostFactory::new();\n }", "function getFactory(){\n\treturn $_SESSION[ SESSION_NAME_SPACE ][ 'factory' ];\n}" ]
[ "0.653443", "0.6402632", "0.6351246", "0.6351246", "0.6351246", "0.6351246", "0.6351246", "0.6351246", "0.6351246", "0.6351246", "0.6341162", "0.6333475", "0.63283134", "0.6220093", "0.62157875", "0.6135545", "0.6079454", "0.6043304", "0.6030623", "0.5974056", "0.58680505", "0.58402085", "0.5805309", "0.5716975", "0.5706775", "0.5683173", "0.5678356", "0.5664196", "0.56301284", "0.5611327" ]
0.65878534
0
/! \brief Let the user choose the new service to create.
function newService($action = "") { $this->closeDialogs(); $serv = preg_replace('/^new_/', '', $action); $this->plugins[$serv]->is_account = TRUE; $this->dialogObject = $this->plugins[$serv]; $this->current = $serv; $this->dialog = TRUE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function creating(Service $Service)\n {\n //code...\n }", "public function addService()\n {\n $option = 'submitnewservice';\n return view('cmsServicesAdd', ['title'=>'Add Service','option'=>$option]);\n }", "public function create()\n {\n if (Gate::denies('service.create')) {\n session()->flash('warning', 'You do not have permission to create a service');\n return redirect()->back();\n }\n return view('pages.settings.services-type.create');\n }", "public function create(){\n return view('admin/service/service_create');\n }", "public function create()\n {\n return view(\"admin.services.create\");\n }", "public function create()\n {\n $services = Service::all();\n return view('back.service.addService', compact('services'));\n }", "public function create()\n {\n //\n\t\treturn view('services.create');\n }", "function _wsdl_docs_service_create($data) {\n // Confirm service name is unique\n $service_id = _wsdl_docs_get_service_id($data['name']);\n if ($service_id) {\n return 'Service with this name already exists';\n }\n // Create new WSDL service.\n $service = entity_create('wsclient_service', array('type' => 'soap'));\n $service->label = $data['name'];\n $service->name = strtolower(str_replace('-', '_', str_replace(' ', '_', $data['name'])));\n $service->save();\n $name = $data['name'];\n $id = $service->id;\n return \"WSDL service $name, ID: $id added.\";\n}", "public function create()\n {\n return view('admin/services.service.create');\n }", "public function creating(Service $service)\n {\n $service->slug = Str::slug($service->name);\n }", "public function listsServicesPost()\r\n {\r\n $input = Request::all();\r\n $new_serivce = Services::create($input);\r\n if($new_serivce){\r\n return response()->json(['msg'=> 'Created a new service'],200);\r\n }else{\r\n return response('Oops, seems like something went wrong while trying to create a new service');\r\n }\r\n }", "public function create()\n {\n return view('widegts::services.create');\n }", "public function create()\n\t{\n\t $services = Services::pluck(\"name\", \"id\")->prepend('Please select', 0);\n\n\t \n\t return view('admin.photoservices.create', compact(\"services\"));\n\t}", "public function add_service() {\r\n if (USER_ROLE == ROLE_ONE) {\r\n $result['companies'] = $this->company_model->get_companies_id_name();\r\n $this->load->view('webpages/add_service', $result);\r\n } else {\r\n $this->load->view('webpages/404');\r\n }\r\n }", "public function create()\n {\n return view('admin.services.create');\n \n }", "public function create()\n {\n $subservices = $this->subservice->lists('title', 'id');\n return view('admin.service.create', compact('subservices'));\n }", "public function created(Service $service)\n {\n //\n }", "public function create()\n {\n $this->data[\"form\"] = \"add\";\n return view(\"admin.pages.services\",$this->data);\n }", "public function create()\n {\n return view('backend.services.add');\n }", "public function create()\n {\n $service = Service::pluck('libelle','direction')->all();\n return view('services.create',compact('service'));\n }", "public function create()\n {\n return view('admin.services.add');\n }", "public function actionCreate()\n {\n $model = new Service();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n\n $cities = Yii::$app->getRequest()->post('cities');\n\n $model->attachCities($cities);\n\n $requestTypes = Yii::$app->getRequest()->post('request_types');\n\n $model->attachRequestTypes($requestTypes);\n\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function create()\r\n\t{\r\n\t\treturn View::make('services.create');\r\n\t}", "public function create()\n {\n return view('adminlte.services.create');\n }", "public function new_form(){\n $this->vars['page_header'] = __('Create New Service', 'latepoint');\n $this->vars['breadcrumbs'][] = array('label' => __('Create New Service', 'latepoint'), 'link' => false );\n\n $this->vars['category'] = new OsServiceCategoryModel();\n\n if($this->get_return_format() == 'json'){\n $response_html = $this->render($this->views_folder.'new_form', 'none');\n echo wp_send_json(array('status' => 'success', 'message' => $response_html));\n exit();\n }else{\n echo $this->render($this->views_folder . 'new_form', $this->get_layout());\n }\n }", "public function create()\n\t{\n\t\treturn View::make('services.create');\n\t}", "public function created(Service $Service)\n {\n //code...\n }", "public function create()\n {\n\n $services = Service::where('locale', 'en')->get();\n foreach ($services as $key => $item) {\n $_services = Service::where('serviceid', $item->serviceid)->get();\n if (count($_services) == 14)\n unset($services[$key]);\n }\n\n return view(\"services.create\", ['services' => $services]);\n }", "public function create()\n {\n return view('admin.services.create');\n }", "public function create()\n {\n return view('admin.services.create');\n }" ]
[ "0.7282651", "0.70714736", "0.68964577", "0.67849046", "0.6778415", "0.67771006", "0.67576385", "0.67561036", "0.67430365", "0.66446334", "0.6635683", "0.6629972", "0.6595493", "0.6584084", "0.6574064", "0.655998", "0.65472806", "0.6525126", "0.6498041", "0.6491219", "0.64813447", "0.64662266", "0.64612204", "0.6458788", "0.6455573", "0.645411", "0.64431334", "0.6418256", "0.6400465", "0.6400465" ]
0.7298347
0
/!\brief Close all opened dialogs And reset "dialog open" flags to display bottom buttons again.
function closeDialogs() { management::closeDialogs(); $this->dialog = FALSE; /* Get our dn back */ $this->dn = $this->last_dn; set_object_info($this->dn); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function closeModal()\n {\n $this->isOpen = false;\n }", "public function closeModal()\n {\n $this->isOpen = false;\n }", "public function closeModal()\n {\n $this->isOpen = false;\n }", "public function closeModal()\n {\n $this->isOpen = false;\n }", "public function closeModal()\n {\n $this->isModal = false;\n }", "public function close_content_pane() {\n\t\t$this->disp('closemainbox.tpl');\n\t}", "public function closeWindow();", "public static function closeAll()\n {\n Collection::make(static::$browsers)->each->quit();\n\n static::$browsers = collect();\n }", "public function closeWindow() {}", "function close_all()\r\n {\r\n $display_content = '<script type=\"text/javascript\">';\r\n foreach ($this->folders as $folder)\r\n $display_content .= \"opml_browser.clickFolder('\" . $folder . \"');\";\r\n $display_content .= '</script>';\r\n return $display_content;\r\n }", "function nc__dlg__end(){\n\n\t\t//output function name\n\t\tnc__util__func('class', 'nc__dlg__end');\n\n\t\t\t\t\t\t//end dialog for content body (starts in another function)\n\t\t\t\t\t\techo \"</div>\" .\n\n\t\t\t\t\t//end dialog content window (starts in another function)\n\t\t\t\t\t\"</div>\" .\n\n\t\t\t\t//end dialog body (starts in another function)\n\t\t\t\t\"</div>\" .\n\n\t\t\t//end end dialog bounding DIV (starts in another function)\n\t\t\t\"</div>\";\n\n\t}", "private function closeDetailsDialog() {\n\t\t$pageObject = $this->webUIGeneralContext->getCurrentPageObject();\n\t\ttry {\n\t\t\t$pageObject->closeDetailsDialog();\n\t\t} catch (Exception $e) {\n\t\t\t//ignore if dialog cannot be closed\n\t\t\t//most likely there is no dialog open\n\t\t}\n\t}", "public static function unhideWindow() {}", "function initializeDeleteMultipleFilesDialog() {\n $files = $this->getFilesById(array_keys($this->params['batch_files']));\n if (is_array($files) && count($files) > 0) {\n include_once(PAPAYA_INCLUDE_PATH.'system/base_msgdialog.php');\n $hidden = array(\n 'cmd' => $this->params['cmd'],\n 'batch_files' => $this->params['batch_files'],\n 'confirm' => 1,\n );\n\n foreach ($files as $fileId => $file) {\n $fileNames[] = $file['file_name'];\n }\n\n $fileNamesList = '\"'.implode('\", \"', $fileNames).'\"';\n\n $this->dialog = new base_msgdialog(\n $this,\n $this->paramName,\n $hidden,\n sprintf(\n $this->_gt('Do you really want to delete %s ?'),\n $fileNamesList\n ),\n 'warning'\n );\n $this->dialog->msgs = &$this->msgs;\n $this->dialog->buttonTitle = 'Delete';\n } else {\n $this->addMSG(MSG_INFO, $this->_gt('No files found.'));\n }\n }", "public function setClose()\n {\n $this->close = true;\n }", "public function closeTipsPrompt() {\n $this->saveTipsList(NULL);\n }", "public function set_all_orders_to_closed() {\n $segments = $this->uri->segment_array();\n $table_id = $segments[3];\n\n // deleting all unnecessary segments (url parts and $table_id)\n unset($segments[0], $segments[1], $segments[2], $segments[3]);\n\n foreach ($segments as $id_order) {\n $this->create_order_record($id_order);\n $this->m_orders_overview->close_order($id_order);\n }\n\n $this->m_orders_overview->close_all_orders($table_id);\n $this->show_order();\n }", "public function onClose();", "public function onClose();", "public static function closeAll($linkIDs) {\n\t\tif (empty($linkIDs)) return;\n\t\t\n\t\t$sql = \"UPDATE \twcf\".WCF_N.\"_linklist_link\n\t\t\tSET\tisClosed = 1\n\t\t\tWHERE \tlinkID IN (\".$linkIDs.\")\";\n\t\tWCF::getDB()->registerShutdownUpdate($sql);\n\t}", "public function turnOffWaitingChecks()\n {\n $this->isModal = true;\n return;\n }", "public function close() {\n\t\twhile ( count( $this->mWorkStack ) ) {\n\t\t\t$this->profileOut( 'close' );\n\t\t}\n\t}", "public function getPageClose() {}", "public function closeChatPopup()\n {\n Cookie::queue('chatPopupShow', 'false', 60);\n $this->chatPopupVisibility = false;\n }", "static function close()\n\t{\n\t\tforeach (self::$dbConnections as $dbName => $db)\n\t\t{\n\t\t\t$db->close();\n\t\t\tunset(self::$dbConnections[$dbName]);\n\t\t}\n\n\t\tforeach(self::$extraConnections as $index => $db)\n\t\t{\n\t\t\t$db->close();\n\t\t\tunset(self::$extraConnections[$index]);\n\t\t}\n\t}", "function close()\r\n\t{\r\n\t\tunset($this->urlprefix);\r\n\t\tunset($this->xml_parser);\r\n\t}", "function removeAllHiddenTabs()\r\n\t{\r\n\t\t$this->hidden_tab = array();\r\n\t}", "function close() {}", "public function btnCalculator_Close() {\n\t\t\t$this->txtValue->Text = $this->dlgCalculatorWidget->Value;\n\t\t}", "abstract public function closeControl();" ]
[ "0.5628627", "0.5628627", "0.5628627", "0.5628627", "0.5427189", "0.5297497", "0.52536917", "0.5211063", "0.5165551", "0.5128363", "0.51225746", "0.5067337", "0.5041713", "0.49300697", "0.49270236", "0.49194652", "0.49063772", "0.48965254", "0.48965254", "0.47861335", "0.47401154", "0.47175375", "0.46873435", "0.46847022", "0.4680722", "0.46738592", "0.4662589", "0.46566042", "0.46523535", "0.46514648" ]
0.7388481
0
/! \brief Returns the list of of services, active services. Used in the filter class for services. class_filterServerService.inc
static function getServiceList() { return session::get('ServerService'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getListServices () {\n return self::findByStatus(self::STATUS_ACTIVE);\n }", "public function getServices()\n {\n return $this->services;\n }", "public function getServices()\n {\n return $this->services;\n }", "public function getServices()\n {\n return $this->services;\n }", "public function getServices() {\n return $this->services;\n }", "public function getServices() {\n return $this->services;\n }", "public function getServices() {\n\n return $this->services;\n\n }", "protected function getServices()\n {\n return $this->services;\n }", "public function getServices();", "public function getServices()\n {\n return $this->pantonoServices;\n }", "public function &getServices(): array {\n return $this->services;\n }", "public function listAllAvailableServices()\n {\n\t\t$data = $this->call(array(), \"GET\", \"sensors/services/available.json\");\n\t\t$data = $data->{'services'};\n\t\t$serviceArray = new ArrayObject();\n\t\tfor($i = 0; $i<count($data);$i++){\n\t\t\t$serviceArray->append(new Service($data[$i], $this));\n\t\t}\n\t\treturn $serviceArray;\n }", "public static function get_services()\n {\n $ServicesObj = new Services();\n $Services = array();\n try {\n $stmt = $ServicesObj->read();\n $count = $stmt->rowCount();\n if ($count > 0) {\n while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {\n extract($row);\n $p = (object) array(\n \"ServiceID\" => (int) $ServiceID,\n \"ServiceName\" => $ServiceName,\n );\n\n array_push($Services, $p);\n }\n }\n return $Services;\n } catch (Exception $e) {\n throw $e;\n }\n }", "public function getServices(): array;", "function getServices() {\n\t\t$results = \"\";\n\t\t$sql = 'SELECT * FROM Service';\n\n\t\t$results = queryDB($sql);\n\n\t\treturn $results;\n\t}", "public static function getServices(): array\n {\n return static::$services;\n }", "public function getServices()\r\n {\r\n if (is_null($this->_services)) {\r\n if ($this->getConfig('auto')) {\r\n $this->_services = array();\r\n $config = Mage::app()->getConfig();\r\n foreach (array('cache', 'full_page_cache', 'fpc') as $cacheType) {\r\n $node = $config->getXpath('global/' . $cacheType . '[1]');\r\n if (isset($node[0]->backend) && in_array((string)$node[0]->backend, array(\r\n 'Cm_Cache_Backend_Redis',\r\n 'Mage_Cache_Backend_Redis'\r\n ))) {\r\n $this->_services[] = $this->_buildServiceArray(\r\n $this->__(str_replace('_', ' ', uc_words($cacheType))),\r\n $node[0]->backend_options->server,\r\n $node[0]->backend_options->port,\r\n $node[0]->backend_options->password,\r\n $node[0]->backend_options->database\r\n );\r\n }\r\n }\r\n // get session\r\n $node = $config->getXpath('global/redis_session');\r\n if ($node) {\r\n $this->_services[] = $this->_buildServiceArray(\r\n $this->__('Session'),\r\n $node[0]->host,\r\n $node[0]->port,\r\n $node[0]->password,\r\n $node[0]->db\r\n );\r\n }\r\n } else {\r\n $this->_services = unserialize($this->getConfig('manual'));\r\n }\r\n }\r\n return $this->_services;\r\n }", "public function get_services() {\n return $this->linkemperor_exec(null, null,\"/api/v2/customers/services.json\");\n }", "public static function get_services()\n {\n return [\n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\CustomPostType::class,\n Base\\CustomMetaBox::class,\n Base\\Shortcode::class,\n Base\\Cron::class,\n ];\n }", "protected function getServicesList()\n {\n $servicesList = [];\n $services = $this->getInstalledServices();\n foreach ($services as $serviceType => $installedServices) {\n $servicesList[] = $this->getServiceTypeList($serviceType, $installedServices);\n }\n return $servicesList;\n }", "public function getAvailableServices()\n {\n return array_keys($this->_servicesConfig);\n }", "public static function get_services() {\n return [ \n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\SettingsLinks::class,\n Base\\JsObjectsManager::class,\n Base\\ShortCodesManager::class\n ];\n }", "public function getAvailableServices();", "public function servicesArray()\n {\n return [\n self::PAINTING,\n self::TIRE,\n self::BODY_WORK,\n self::TO,\n self::WASHING,\n ];\n }", "function get_service_list() {\n\t\tglobal $wpdb;\n\t\t\n\t\t$services = $wpdb->get_results( \n\t\t\t\"\n\t\t\tSELECT ID, Title\n\t\t\tFROM cp_Categories\n\t\t\tWHERE 1\n\t\t\t\",\n\t\t\tARRAY_A\n\t\t);\n\t\t\n\t\treturn $services;\n\t}", "public static function get_services()\n {\n\n //підключаємо всі необхідні класи для активації через масив\n return [\n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\SettingsLinks::class\n ];\n }", "public function services($ignore_cache = false) {\n if ($this->services === null || $ignore_cache) {\n $this->services = StatusBoard_Service::allForSite($this);\n }\n \n return $this->services;\n }", "public static function get_services(): array\n {\n return [\n Base\\SettingsLinks::class,\n Pages\\Admin::class,\n Base\\Enqueue::class,\n CPT\\EmailCpt::class,\n ];\n }", "private function get_services() {\n\t\treturn [\n\t\t\tServices\\Language_Loader::class,\n\t\t\tServices\\Setup_Database::class,\n\t\t\tServices\\Scripts_And_Templates::class,\n\t\t\tServices\\Admin_Pages::class,\n\t\t\tServices\\Setup_Settings_Page::class,\n\t\t\tServices\\Loggers_Loader::class,\n\t\t\tServices\\Dropins_Loader::class,\n\t\t\tServices\\Setup_Log_Filters::class,\n\t\t\tServices\\Setup_Pause_Resume_Actions::class,\n\t\t\tServices\\Setup_Purge_DB_Cron::class,\n\t\t\tServices\\API::class,\n\t\t\tServices\\Dashboard_Widget::class,\n\t\t\tServices\\Network_Menu_Items::class,\n\t\t\tServices\\Plugin_List_Link::class,\n\t\t];\n\t}", "function AllServices(){\n return $this->db->get($this->service)->result();\n }" ]
[ "0.8080548", "0.75776476", "0.75776476", "0.75776476", "0.75444704", "0.75444704", "0.74481744", "0.7399029", "0.736209", "0.7200411", "0.71679336", "0.7080594", "0.70667094", "0.6993931", "0.69681054", "0.69099975", "0.6899074", "0.6889862", "0.6847158", "0.67877805", "0.67370576", "0.67324317", "0.67261285", "0.6723409", "0.6715947", "0.6692131", "0.66706204", "0.66639256", "0.6663653", "0.6642494" ]
0.76281357
1
/! \brief Updates the status for a list of services.
function updateServiceStatus($action, $target, $all) { /* Skip if this is a new server */ if ($this->dn == "new") { msg_dialog::display(_("Information"), _("Cannot update service status until it has been saved!"), INFO_DIALOG); return; } /* Is this an existing action */ if (!isset(self::$actionStatus[$action])) { msg_dialog::display(_("Error"), _("Unknown action $action"), ERROR_DIALOG); return; } /* Handle state changes for services */ foreach ($target as $service) { $this->updateSingleServiceStatus($action, $service); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateStatus(array $jobs);", "function update_status()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\tif(!empty($data['t']) && !empty($data['list'])) $result = $this->_bid->update_status($data['t'], explode('--',$data['list']));\n\t\t\n\t\t$data['msg'] = !empty($result['boolean']) && $result['boolean']? 'The bid status has been changed.': 'ERROR: The bid status could not be changed.';\n\t\t\n\t\t$data['area'] = 'refresh_list_msg';\n\t\t$this->load->view('addons/basic_addons', $data);\n\t}", "public function updateStatuses()\n {\n $affected = DB::update('UPDATE los_orders SET status_code=1 WHERE status_code=0 AND order_date IN (SELECT provide_date FROM los_lunchdates WHERE orders_placed IS NOT NULL)');\n $affected = DB::update('UPDATE los_orders SET status_code=0 WHERE status_code=1 AND order_date IN (SELECT provide_date FROM los_lunchdates WHERE orders_placed IS NULL)');\n }", "function update_status()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\t\n\t\tif(!empty($data['t']) && !empty($data['list'])) $response = $this->_tender->update_status($data['t'], explode('--',$data['list']));\n\t\t\n\t\t# all good\n\t\tif(!empty($response) && $response['boolean']){\n\t\t\t$data['msg'] = 'The Invitation for Bids/Quotations status has been updated.';\n\t\t\t$data['area'] = 'refresh_list_msg';\n\t\t} \n\t\t# there was an error\n\t\telse {\n\t\t\t$data['msg'] = (!empty($data['t']) && !empty($data['list']))? 'ERROR: There was an error updating the Invitation for Bids/Quotations status.': 'ERROR: This action can not be resolved';\n\t\t\t$data['area'] = 'basic_msg';\n\t\t}\n\t\t\n\t\t$this->load->view('addons/basic_addons', $data);\n\t}", "function changeServiceStatus ($pid_arr)\n{\n global $_TABLES;\n\n // first, disable all\n DB_query (\"UPDATE {$_TABLES['pingservice']} SET is_enabled = '0'\");\n if (isset($pid_arr)) {\n foreach ($pid_arr as $pid) { //enable those listed\n $pid = addslashes (COM_applyFilter ($pid, true));\n if (!empty ($pid)) {\n DB_query (\"UPDATE {$_TABLES['pingservice']} SET is_enabled = '1' WHERE pid = '$pid'\");\n }\n }\n }\n}", "public function update_status();", "public function update(Request $request, ServiceList $serviceList) {\n $action = $request->get(\"action\");\n $id = $request->get(\"id\");\n switch ($action) {\n \n case \"update\":\n $items = $this->saveItemList(Auth::id(), $request->get('items'));\n $arr = array(\n \"ser_cat_id\" => decrypt($request->get('service_id')),\n \"ser_pro_name\" => trim($request->get('provider_name')),\n \"user_ser_exp\" => trim($request->get('ser_exp')),\n \"ser_dec\" => trim($request->get('dec_msg')),\n\n \"ser_phone\" => trim($request->get('ser_phone')),\n \"ser_email\" => trim($request->get('ser_email')),\n \"ser_web\" => trim($request->get('ser_website')),\n \"ser_fb\" => trim($request->get('ser_fblink')),\n \"ser_tw\" => trim($request->get('ser_twlink')),\n \"ser_linkedin\" => trim($request->get('ser_ldlink')),\n\n \"ser_photo\" => $request->get('ser_img'),\n \"doc_no\" => trim($request->get('ser_doc_no')),\n \"doc_image\" => $request->get('doc_img'),\n\n \"ser_state\" => Crypt::decryptString(trim($request->get('ser_state'))),\n \"ser_city\" => Crypt::decryptString(trim($request->get('ser_city'))),\n \"ser_address\" => trim($request->get('ser_address')),\n \"pin_no\" => trim($request->get('ser_pin_no')),\n\n \"ser_days\" => $request->get('days'),\n \"ser_time\" => $request->get('time'),\n \"ser_item_id\" => $items\n );\n ServiceList::where(\"ser_id\", decrypt($id))->update($arr);\n break;\n\n case \"status\":\n $status = decrypt($request->get('status'));\n $arr = array();\n if ( $status == \"Active\" ) { $arr['ser_status'] = \"Inactive\"; }\n else if ( $status == \"Inactive\" ) { $arr['ser_status'] = \"Active\"; }\n else { break; }\n ServiceList::where(\"ser_id\", decrypt($id))->update($arr);\n return encrypt($arr['ser_status']);\n break;\n }\n return true; \n }", "function update_status(){\n $service_id=$this->uri->segment(4);\n $status=$this->uri->segment(5);\n $this->services->update_service_status($service_id,$status);\n $this->session->set_flashdata(\"success_msg\",\"Service status has been updated successfully.\");\n redirect(site_url(\"admin/services\"));\n }", "public function listsServicesPut($service_id)\r\n {\r\n $input = Request::all();\r\n $service = Services::findOrFail($service_id);\r\n $service->update(['name' => $input['name']]);\r\n if($service->save()){\r\n return response()->json(['msg' => 'Updated service']);\r\n }else{\r\n return response('Oops, it seems like somthing went wrong while trying to update the servie');\r\n }\r\n }", "public function UserListChangeStatus(): void{\n \n if(!ArtworkVerifier::setStatusList($_POST) || !Session::isLogin()){\n exit;\n }\n \n if(isset(UserList::where('user_list.user_id', Session::getUser()['id'])->where('user_list.artwork_id', $_POST['artwork_id'])->getOne()->id)){\n UserList::values([ 'user_list.status' => $_POST['status'] ])\n ->where('user_id' ,Session::getUser()['id'])\n ->where('artwork_id', $_POST['artwork_id'])\n ->update();\n exit;\n }\n }", "public function update(Request $request, Services $services)\n {\n //\n }", "public function update(Request $request, Services $services)\n {\n //\n }", "private function updateSingleServiceStatus($action, $service)\n {\n if ($this->plugins[$service]->is_account) {\n $this->updateServicesVars($service);\n\n $s_daemon = new supportDaemon();\n if ($s_daemon->is_error()) {\n msg_dialog::display(\n sprintf(_(\"Could not get execute action %s on service %s.\"), $action, $service),\n msgPool::siError($s_daemon->get_error()), ERROR_DIALOG\n );\n } else {\n $target = array($this->parent->getBaseObject()->netConfigDNS->macAddress);\n if ($action == 'status') {\n $res = $s_daemon->append_call(\"Service.is_running\", $target, array(\"args\" => array($service)));\n if ($s_daemon->is_error()) {\n msg_dialog::display(\n sprintf(_(\"Could not get execute action %s on service %s.\"), $action, $service),\n msgPool::siError($s_daemon->get_error()), ERROR_DIALOG\n );\n } else {\n $this->plugins[$service]->setStatus($res == \"yes\"?\"running\":\"stopped\");\n }\n } else {\n $res = $s_daemon->append_call(\"Service.manage\", $target, array(\"args\" => array($service, $action)));\n\n if ($s_daemon->is_error()) {\n msg_dialog::display(\n sprintf(_(\"Could not get execute action %s on service %s.\"), $action, $service),\n msgPool::siError($s_daemon->get_error()), ERROR_DIALOG\n );\n } elseif (preg_match(\"/^done/\", $res)) {\n $this->plugins[$service]->setStatus(self::$actionStatus[$action]);\n }\n }\n }\n }\n }", "public function updating(Service $Service)\n {\n //code...\n }", "function PKG_changeClientJobsStatus($packageIDList,$status)\n{\n\tCHECK_FW(CC_jobstatus, $status);\n\tPKG_executeOnClientJobs(\"UPDATE `clientjobs` SET `status` = '$status' WHERE \",$packageIDList);\n}", "public function updateStatus($params)\r\n {\r\n }", "public function updated(Service $service)\n {\n //\n }", "public function updateStatus() {\n try {\n if (!($this->toDoList instanceof Base_Model_ObtorLib_App_Core_Crm_Entity_ToDoList)) {\n throw new Base_Model_ObtorLib_App_Core_Crm_Exception(\" ToDoList Entity not intialized\");\n } else {\n $objToDoList = new Base_Model_ObtorLib_App_Core_Crm_Dao_ToDoList();\n $objToDoList->toDoList = $this->toDoList;\n return $objToDoList->updateStatus();\n }\n } catch (Exception $ex) {\n throw new Base_Model_ObtorLib_App_Core_Crm_Exception($ex);\n }\n }", "public function updateStatus(Request $request)\n\t{\n\t\t$status;\n\t\tif ($request->status === 'true') {\n\t\t\t$status = 1;\n\t\t} elseif ($request->status === 'false') {\n\t\t\t$status = 0;\n\t\t}\n\t\tDB::table('list_items')\n\t\t\t->where('id', $request->id)\n\t\t\t->update(['status' => $status]);\n\t}", "public function update(Request $request, Services $services)\n {\n //\n $service_update = Services::find($request->id_update);\n $kind = $request->kind_update;\n $service_update->service = $request->service_update;\n $service_update->price = $request->price_update;\n $service_update->unit = $request->unit_update;\n $service_update->save(); \n return redirect('admin/services?kind='.$kind);\n }", "public function updated(Service $Service)\n {\n //code...\n }", "private function manageStatus()\n {\n $this->updateStatus();\n $this->checkStatus();\n }", "function changeStatus() {\n\n $newStatus = $_GET['newstatus'];\n\n foreach ($_POST['status'] as $key => $val) {\n \n DB::update(CFG::$tblPrefix . \"ticket\", array(\"status\" => $newStatus), \" id=%d \", $key);\n \n }\n }", "public function update_about_us_services_info($data){\r\n $query = \"UPDATE tbl_aboutus_service SET service_icon='$data[service_icon]', service_title='$data[service_title]', service_desc='$data[service_desc]', \r\n publication_status='$data[publication_status]' WHERE service_id='$data[service_id]'\";\r\n if (mysqli_query($this->db_connect, $query)) {\r\n session_start();\r\n $_SESSION['message'] = \"About Us Services Updated Successfully!\";\r\n header('Location: manage_services.php');\r\n } else {\r\n die(\"Query Problem! \" . mysqli_error($this->db_connect));\r\n }\r\n\r\n }", "public function requestStatus(Request $request) {\n\t\t$services = Service::findOrFail($request -> submit);\n\n\t\t$services -> update(['status' => $request -> status]);\n\n\t\t$user = User::where('id', '=', $services -> user_id) -> get() -> first();\n\n\t\tif (isset($services -> status)) {\n\n\t\t\tMail::send('auth/emails.statusChange', ['services' => $services], function($m) use ($services, $user) {\n\n\t\t\t\t$m -> from('[email protected]', 'Team AfterCares');\n\n\t\t\t\t$m -> to($user -> email, $user -> name) -> subject('Change in status of request');\n\t\t\t});\n\n\t\t\treturn back() -> withInput();\n\t\t}\n\n\t}", "public function listsstatusput($status_id)\r\n {\r\n $input = Request::all();\r\n $status = Status::findOrFail($status_id);\r\n $status->update(['name' => $input['name']]);\r\n if($status->save()){\r\n return response()->json(['msg' => 'Update status']);\r\n }else{\r\n return response('Oops, it seems like there was a problem updating the status');\r\n }\r\n }", "public function testUpdateServiceData()\n {\n\n }", "function listServices()\n{\n global $LANG_ADMIN, $LANG_TRB, $_CONF, $_IMAGE_TYPE, $_TABLES;\n\n require_once $_CONF['path_system'] . 'lib-admin.php';\n\n $retval = '';\n\n $header_arr = array( # display 'text' and use table field 'field'\n array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false),\n array('text' => $LANG_TRB['service'], 'field' => 'name', 'sort' => true),\n array('text' => $LANG_TRB['ping_method'], 'field' => 'method', 'sort' => true),\n array('text' => $LANG_TRB['service_ping_url'], 'field' => 'ping_url', 'sort' => true),\n array('text' => $LANG_ADMIN['enabled'], 'field' => 'is_enabled', 'sort' => false)\n );\n\n $defsort_arr = array('field' => 'name', 'direction' => 'asc');\n\n $menu_arr = array (\n array('url' => $_CONF['site_admin_url'] . '/trackback.php?mode=editservice',\n 'text' => $LANG_ADMIN['create_new']),\n array('url' => $_CONF['site_admin_url'],\n 'text' => $LANG_ADMIN['admin_home']));\n\n $retval .= COM_startBlock($LANG_TRB['services_headline'], '',\n COM_getBlockTemplate('_admin_block', 'header'));\n\n $retval .= ADMIN_createMenu(\n $menu_arr,\n $LANG_TRB['service_explain'],\n $_CONF['layout_url'] . '/images/icons/trackback.' . $_IMAGE_TYPE\n );\n\n $text_arr = array(\n 'has_extras' => true,\n 'form_url' => $_CONF['site_admin_url'] . '/trackback.php',\n 'help_url' => getHelpUrl() . '#ping'\n );\n\n $query_arr = array(\n 'table' => 'pingservice',\n 'sql' => \"SELECT * FROM {$_TABLES['pingservice']} WHERE 1=1\",\n 'query_fields' => array('name', 'ping_url'),\n 'default_filter' => \"\",\n 'no_data' => $LANG_TRB['no_services']\n );\n\n // this is a dummy variable so we know the form has been used if all services\n // should be disabled in order to disable the last one.\n $form_arr = array('bottom' => '<input type=\"hidden\" name=\"serviceChanger\" value=\"true\"' . XHTML . '>');\n\n $retval .= ADMIN_list('pingservice', 'ADMIN_getListField_trackback',\n $header_arr, $text_arr, $query_arr, $defsort_arr,\n '', SEC_createToken(), '', $form_arr);\n $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));\n\n if ($_CONF['trackback_enabled']) {\n $retval .= freshTrackback ();\n }\n if ($_CONF['pingback_enabled']) {\n $retval .= freshPingback ();\n }\n\n return $retval;\n}", "public function update(){\n $service_category = new OsServiceCategoryModel($this->params['service_category']['id']);\n $service_category->set_data($this->params['service_category']);\n if($service_category->save()){\n $response_html = __('Service Category Updated. ID: ', 'latepoint') . $service_category->id;\n $status = LATEPOINT_STATUS_SUCCESS;\n }else{\n $response_html = $service_category->get_error_messages();\n $status = LATEPOINT_STATUS_ERROR;\n }\n if($this->get_return_format() == 'json'){\n $this->send_json(array('status' => $status, 'message' => $response_html));\n }\n }", "public function testUpdateService()\n {\n\n }" ]
[ "0.6621634", "0.6532585", "0.6461127", "0.64142805", "0.639287", "0.6369591", "0.63390523", "0.6298918", "0.62922907", "0.6215053", "0.619058", "0.619058", "0.6136992", "0.6097271", "0.6083418", "0.60473", "0.60130614", "0.5994864", "0.5939064", "0.59371185", "0.5877184", "0.58448094", "0.5774453", "0.5741484", "0.5739016", "0.5713284", "0.5700105", "0.56852365", "0.5613697", "0.5607399" ]
0.7052105
0
/! \brief Updates the status of a service and calls an external hook if specified in fusiondirectory.conf
private function updateSingleServiceStatus($action, $service) { if ($this->plugins[$service]->is_account) { $this->updateServicesVars($service); $s_daemon = new supportDaemon(); if ($s_daemon->is_error()) { msg_dialog::display( sprintf(_("Could not get execute action %s on service %s."), $action, $service), msgPool::siError($s_daemon->get_error()), ERROR_DIALOG ); } else { $target = array($this->parent->getBaseObject()->netConfigDNS->macAddress); if ($action == 'status') { $res = $s_daemon->append_call("Service.is_running", $target, array("args" => array($service))); if ($s_daemon->is_error()) { msg_dialog::display( sprintf(_("Could not get execute action %s on service %s."), $action, $service), msgPool::siError($s_daemon->get_error()), ERROR_DIALOG ); } else { $this->plugins[$service]->setStatus($res == "yes"?"running":"stopped"); } } else { $res = $s_daemon->append_call("Service.manage", $target, array("args" => array($service, $action))); if ($s_daemon->is_error()) { msg_dialog::display( sprintf(_("Could not get execute action %s on service %s."), $action, $service), msgPool::siError($s_daemon->get_error()), ERROR_DIALOG ); } elseif (preg_match("/^done/", $res)) { $this->plugins[$service]->setStatus(self::$actionStatus[$action]); } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update_status();", "public function testUpdateService()\n {\n\n }", "public function hookUpdate(): void\n {\n $this->say(\"Executing the Plugin's update hook...\");\n $this->_exec(\"php ./src/hook_update.php\");\n }", "public function updating(Service $Service)\n {\n //code...\n }", "public function testUpdateServiceData()\n {\n\n }", "function update_status()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\t\n\t\tif(!empty($data['t']) && !empty($data['list'])) $response = $this->_tender->update_status($data['t'], explode('--',$data['list']));\n\t\t\n\t\t# all good\n\t\tif(!empty($response) && $response['boolean']){\n\t\t\t$data['msg'] = 'The Invitation for Bids/Quotations status has been updated.';\n\t\t\t$data['area'] = 'refresh_list_msg';\n\t\t} \n\t\t# there was an error\n\t\telse {\n\t\t\t$data['msg'] = (!empty($data['t']) && !empty($data['list']))? 'ERROR: There was an error updating the Invitation for Bids/Quotations status.': 'ERROR: This action can not be resolved';\n\t\t\t$data['area'] = 'basic_msg';\n\t\t}\n\t\t\n\t\t$this->load->view('addons/basic_addons', $data);\n\t}", "function updateServiceStatus($action, $target, $all)\n {\n /* Skip if this is a new server */\n if ($this->dn == \"new\") {\n msg_dialog::display(_(\"Information\"), _(\"Cannot update service status until it has been saved!\"), INFO_DIALOG);\n return;\n }\n\n /* Is this an existing action */\n if (!isset(self::$actionStatus[$action])) {\n msg_dialog::display(_(\"Error\"), _(\"Unknown action $action\"), ERROR_DIALOG);\n return;\n }\n\n /* Handle state changes for services */\n foreach ($target as $service) {\n $this->updateSingleServiceStatus($action, $service);\n }\n }", "function update_status($status) {\n\tglobal $pkg_interface;\n\n\tif ($pkg_interface == \"console\") {\n\t\tprint (\"{$status}\");\n\t}\n\n\t/* ensure that contents are written out */\n\tob_flush();\n}", "public function updated(Service $Service)\n {\n //code...\n }", "public function updated(Service $service)\n {\n //\n }", "function update_status()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\tif(!empty($data['t']) && !empty($data['list'])) $result = $this->_bid->update_status($data['t'], explode('--',$data['list']));\n\t\t\n\t\t$data['msg'] = !empty($result['boolean']) && $result['boolean']? 'The bid status has been changed.': 'ERROR: The bid status could not be changed.';\n\t\t\n\t\t$data['area'] = 'refresh_list_msg';\n\t\t$this->load->view('addons/basic_addons', $data);\n\t}", "public function run_service()\n\t{\n\t\t// Route the API task\n\t\t$this->_route_api_task();\n\t}", "public function updateBaseServiceStatus($userid, $service, $action)\n {\n $sql = \"update subscriber_services ss\n inner join services se\n on ss.service_id = se.service_id\n set provisioned_state = ?\n where ss.subs_id = ?\n and se.service_desc = ?\";\n\n return $this->connection->executeUpdate($sql, [$action, $userid, $service ]);\n }", "function changeServiceStatus ($pid_arr)\n{\n global $_TABLES;\n\n // first, disable all\n DB_query (\"UPDATE {$_TABLES['pingservice']} SET is_enabled = '0'\");\n if (isset($pid_arr)) {\n foreach ($pid_arr as $pid) { //enable those listed\n $pid = addslashes (COM_applyFilter ($pid, true));\n if (!empty ($pid)) {\n DB_query (\"UPDATE {$_TABLES['pingservice']} SET is_enabled = '1' WHERE pid = '$pid'\");\n }\n }\n }\n}", "public function changeFeaturedService($arrParam = null, $options = null) {\n\t\tif ($options['task'] == 'admin-service-change-featured-service') {\n\t\t\t$cid = $arrParam['cid'];\n\t\t\tif (count($cid) > 0) {\t\t\t\t//----- change lock status cho nhieu doi tuong\n\t\t\t\tswitch ($arrParam['type']) {\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\t$featured_service = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'inactive':\n\t\t\t\t\t\t$featured_service = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$strId = implode(',', $cid);\n\t\t\t\t$data = array('featured_service'=>$featured_service);\n\t\t\t\t$where = 'id IN (' .$strId .')';\n\t\t\t\t$this->update($data, $where);\n\t\t\t}\n\t\t\tif (isset($arrParam['id'])) {\t\t//----- change status cho mot doi tuong\n\t\t\t\t$id = $arrParam['id'];\n\t\t\t\tswitch ($arrParam['type']) {\n\t\t\t\t\tcase 'active':\n\t\t\t\t\t\t$featured_service = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'inactive':\n\t\t\t\t\t\t$featured_service = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$data = array('featured_service'=>$featured_service);\n\t\t\t\t$where = 'id = ' .$id;\n\t\t\t\t$this->update($data, $where);\n\t\t\t}\n\t\t}\n\t\n\t}", "public function testUpdateService()\n {\n\n $this->browse(function (Browser $browser) {\n $user = User::factory()->create();\n $service = Service::factory()->create();\n $serviceUpdate = Service::factory()->make();\n $browser->visit('/login')\n ->pause(3000)\n ->type('email', $user->email)\n ->type('password', 'password')\n ->press('Login')\n ->pause(2000)\n ->assertPathIs('/service')\n ->visit('/service/update/'.$service->id)\n ->pause(1000)\n ->type('descricao', $serviceUpdate->descricao)\n ->type('valor', $serviceUpdate->valor)\n ->press('Editar')\n ->pause(1000)\n ->assertSee(Constantes::SUCESSO_UPDATE_SERVICE)\n ->press('OK')\n ->pause(1000);\n\n });\n }", "public function run_service()\n\t{\n\t\t// Check the request is allowed\n\t\tif ($this->_is_api_request_allowed())\n\t\t{\n\t\t\t// Route the API task\n\t\t\t$this->_route_api_task();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Set the response to \"ACCESS DENIED\"\n\t\t\t$this->set_response($this->get_error_msg(006));\n\n\t\t\t// Terminate execution\n\t\t\treturn;\n\t\t}\n\t}", "protected function callService ()\n\t{\n\t\t$this->protocol->callService( $this->data ) ;\n\t}", "function update_status(){\n $service_id=$this->uri->segment(4);\n $status=$this->uri->segment(5);\n $this->services->update_service_status($service_id,$status);\n $this->session->set_flashdata(\"success_msg\",\"Service status has been updated successfully.\");\n redirect(site_url(\"admin/services\"));\n }", "function saveService ($pid, $name, $site_url, $ping_url, $method, $enabled)\n{\n global $_CONF, $_TABLES, $LANG_TRB;\n\n $enabled = ($enabled == 'on' ? 1 : 0);\n if ($method == 'extended') {\n $method = 'weblogUpdates.extendedPing';\n } else {\n $method = 'weblogUpdates.ping';\n }\n\n $name = strip_tags (COM_stripslashes ($name));\n $site_url = strip_tags (COM_stripslashes ($site_url));\n $ping_url = strip_tags (COM_stripslashes ($ping_url));\n\n $errormsg = '';\n if (empty ($name)) {\n $errormsg = $LANG_TRB['error_site_name'];\n } else {\n // all URLs must start with http: or https:\n $parts = explode (':', $site_url);\n if (($parts[0] != 'http') && ($parts[0] != 'https')) {\n $errormsg = $LANG_TRB['error_site_url'];\n } else {\n $parts = explode (':', $ping_url);\n if (($parts[0] != 'http') && ($parts[0] != 'https')) {\n $errormsg = $LANG_TRB['error_ping_url'];\n }\n }\n }\n\n if (!empty ($errormsg)) {\n return editServiceForm ($pid, $errormsg, $name, $site_url, $ping_url,\n $method, $enabled);\n }\n\n $name = addslashes ($name);\n $site_url = addslashes ($site_url);\n $ping_url = addslashes ($ping_url);\n\n if ($pid > 0) {\n DB_save ($_TABLES['pingservice'],\n 'pid,name,site_url,ping_url,method,is_enabled',\n \"'$pid','$name','$site_url','$ping_url','$method','$enabled'\");\n } else {\n DB_save ($_TABLES['pingservice'],\n 'name,site_url,ping_url,method,is_enabled',\n \"'$name','$site_url','$ping_url','$method','$enabled'\");\n }\n\n return COM_refresh ($_CONF['site_admin_url']\n . '/trackback.php?mode=listservice&amp;msg=65');\n}", "public function update(){\n $service_category = new OsServiceCategoryModel($this->params['service_category']['id']);\n $service_category->set_data($this->params['service_category']);\n if($service_category->save()){\n $response_html = __('Service Category Updated. ID: ', 'latepoint') . $service_category->id;\n $status = LATEPOINT_STATUS_SUCCESS;\n }else{\n $response_html = $service_category->get_error_messages();\n $status = LATEPOINT_STATUS_ERROR;\n }\n if($this->get_return_format() == 'json'){\n $this->send_json(array('status' => $status, 'message' => $response_html));\n }\n }", "public function hook();", "public function do_service() {\n $this->params_wrapper->check();\n $this->params_wrapper->wrap();\n $xml_content = XMLBuilder::buildXML($this->params_wrapper->getWrappedParameters());\n $sympa_client = new SympaPLClient();\n $main_robot_name = strtolower($this->params_wrapper->getWrappedParameter(SympaRemoteConstants::INPUT_RNE)).\".\".$this->config->sympa_main_domain;\n\n\t\t$operation = $this->params_wrapper->getWrappedParameter(SympaRemoteConstants::INPUT_OPERATION);\n\t\t$this->log->LogDebug(\"Operation : \" . $operation);\n\t\tswitch ($operation) {\n\t\t\tcase \"CREATE\":\n\t\t\t\t$sympa_client->createListWithXML($xml_content, $this->params_wrapper->getWrappedParameter(SympaPLClient::ARGUMENT_FAMILLE), $main_robot_name);\n\t\t\t\tbreak;\n\t\t\tcase \"UPDATE\":\n\t\t\t\t$sympa_client->updateListWithXML($xml_content, $this->params_wrapper->getWrappedParameter(SympaPLClient::ARGUMENT_FAMILLE), $main_robot_name);\n\t\t\t\tbreak;\n\t\t\tcase \"CLOSE\":\n\t\t\t\t$listname = $this->params_wrapper->getWrappedParameter(SympaRemoteConstants::INPUT_LIST_NAME_TO_CLOSE);\n\t\t\t\t$sympa_client->closeList($listname);\n\t\t\t\tbreak;\n\t\t}\n }", "public function markServiceComplete()\n {\n $id = (int) $_POST['id'];\n if (empty($id))\n return json_encode(array(\n 'success' => false,\n 'error' => array('message' => 'Invalid service id')\n ));\n\n $uid = (int) $_POST['uid'];\n $companyService = new CompanyService();\n $success = $companyService->markServiceComplete($id);\n if ($success) {\n $notificationService = new NotificationService();\n $notificationService->registerEvent(\n \"project_service_delivered\",\n $id,\n $uid\n );\n\n $notificationService->registerEvent(\n \"project_service_expert_review_requested\",\n $id,\n $uid\n );\n }\n\n return json_encode(array(\n 'success' => $success\n ));\n }", "function editServiceForm ($pid, $msg = '', $new_name = '', $new_site_url = '', $new_ping_url = '', $new_method = '', $new_enabled = -1)\n{\n global $_CONF, $_TABLES, $LANG_TRB, $LANG_ADMIN, $MESSAGE;\n\n $retval = '';\n\n if ($pid > 0) {\n $result = DB_query (\"SELECT * FROM {$_TABLES['pingservice']} WHERE pid = '$pid'\");\n $A = DB_fetchArray ($result);\n } else {\n $A['is_enabled'] = 1;\n $A['method'] = 'weblogUpdates.ping';\n }\n\n if (!empty ($new_name)) {\n $A['name'] = $new_name;\n }\n if (!empty ($new_site_url)) {\n $A['site_url'] = $new_site_url;\n }\n if (!empty ($new_ping_url)) {\n $A['ping_url'] = $new_ping_url;\n }\n if (!empty ($new_method)) {\n $A['method'] = $new_method;\n }\n if ($new_enabled >= 0) {\n $A['is_enabled'] = $new_enabled;\n }\n\n $retval .= COM_siteHeader ('menu', $LANG_TRB['edit_service']);\n\n if (!empty ($msg)) {\n $retval .= showTrackbackMessage ('Error', $msg);\n }\n\n $token = SEC_createToken();\n\n $retval .= COM_startBlock($LANG_TRB['edit_service'], getHelpUrl() . '#ping',\n COM_getBlockTemplate('_admin_block', 'header'));\n $retval .= SEC_getTokenExpiryNotice($token);\n\n $template = new Template ($_CONF['path_layout'] . 'admin/trackback');\n $template->set_file (array ('editor' => 'serviceeditor.thtml'));\n $template->set_var('xhtml', XHTML);\n $template->set_var('site_url', $_CONF['site_url']);\n $template->set_var('site_admin_url', $_CONF['site_admin_url']);\n $template->set_var('layout_url', $_CONF['layout_url']);\n $template->set_var('max_url_length', 255);\n $template->set_var('method_ping', 'weblogUpdates.ping');\n $template->set_var('method_ping_extended', 'weblogUpdates.extendedPing');\n\n $template->set_var('lang_name', $LANG_TRB['service']);\n $template->set_var('lang_site_url', $LANG_TRB['service_website']);\n $template->set_var('lang_ping_url', $LANG_TRB['service_ping_url']);\n $template->set_var('lang_enabled', $LANG_ADMIN['enabled']);\n $template->set_var('lang_method', $LANG_TRB['ping_method']);\n $template->set_var('lang_method_standard', $LANG_TRB['ping_standard']);\n $template->set_var('lang_method_extended', $LANG_TRB['ping_extended']);\n $template->set_var('lang_save', $LANG_ADMIN['save']);\n $template->set_var('lang_cancel', $LANG_ADMIN['cancel']);\n\n if ($pid > 0) {\n $delbutton = '<input type=\"submit\" value=\"' . $LANG_ADMIN['delete']\n . '\" name=\"servicemode[2]\"%s' . XHTML . '>';\n $jsconfirm = ' onclick=\"return confirm(\\'' . $MESSAGE[76] . '\\');\"';\n $template->set_var('delete_option',\n sprintf ($delbutton, $jsconfirm));\n $template->set_var('delete_option_no_confirmation',\n sprintf ($delbutton, ''));\n } else {\n $template->set_var('delete_option', '');\n }\n\n if (isset ($A['pid'])) {\n $template->set_var('service_id', $A['pid']);\n } else {\n $template->set_var('service_id', '');\n }\n if (isset ($A['name'])) {\n $template->set_var('service_name', $A['name']);\n } else {\n $template->set_var('service_name', '');\n }\n if (isset ($A['site_url'])) {\n $template->set_var('service_site_url', $A['site_url']);\n } else {\n $template->set_var('service_site_url', '');\n }\n if (isset ($A['ping_url'])) {\n $template->set_var('service_ping_url', $A['ping_url']);\n } else {\n $template->set_var('service_ping_url', '');\n }\n if ($A['is_enabled'] == 1) {\n $template->set_var('is_enabled', 'checked=\"checked\"');\n } else {\n $template->set_var('is_enabled', '');\n }\n if ($A['method'] == 'weblogUpdates.ping') {\n $template->set_var('standard_is_checked', 'checked=\"checked\"');\n $template->set_var('extended_is_checked', '');\n } else {\n $template->set_var('standard_is_checked', '');\n $template->set_var('extended_is_checked', 'checked=\"checked\"');\n }\n $template->set_var('gltoken_name', CSRF_TOKEN);\n $template->set_var('gltoken', $token);\n\n $template->parse ('output', 'editor');\n $retval .= $template->finish ($template->get_var ('output'));\n\n $retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));\n $retval .= COM_siteFooter ();\n\n return $retval;\n}", "public function callGetServiceStatus() {\n\t\t$requestArray = $this->signArray();\n\t\treturn $this->getServiceStatus($requestArray);\n\t}", "function startService()\n {\n\n $this->service_link = $this->_openService($this->url . '/' . $this->service_name . $this->wsdl);\n\n }", "private function updateService(Site $siteService){\n #This case requires the serviceService\n $this->checkServiceServiceSet();\n\n #Identify the service\n try {\n $service = $this->serviceService->getService($this->entityID);\n } catch (\\Exception $e) {\n $this->exceptionWithResponseCode(404,\"A service with the specified id could not be found\");\n }\n\n #Authorisation\n $this->checkAuthorisation ($siteService, $service->getParentSite(), $this->userIdentifier, $this->userIdentifierType);\n\n switch($this->entityProperty) {\n case 'extensionproperties':{\n $this->updateServiceExtensionProperties($service);\n break;\n }\n default: {\n $this->exceptionWithResponseCode(501,$this->genericExceptionMessages[\"entityTypePropertyCombo\"]);\n }\n }\n }", "public function changeStatus()\n {\n }", "public function updateStatus(): void\n {\n $data = json_encode($this->getStatus(), JSON_PRETTY_PRINT);\n File::put(public_path(self::STATUS_FILE_NAME), $data);\n }" ]
[ "0.61929244", "0.60010886", "0.5959199", "0.58522296", "0.5827563", "0.57852453", "0.5784981", "0.57613826", "0.575801", "0.5755635", "0.57478446", "0.57388586", "0.5688334", "0.5596721", "0.55025566", "0.54468364", "0.54137474", "0.5390216", "0.5358307", "0.5326208", "0.53254384", "0.5301706", "0.5287143", "0.52701944", "0.52655816", "0.52338165", "0.5198308", "0.51939434", "0.5180322", "0.5165904" ]
0.66479594
0
/! \brief Returns a list of all used services CLASSNAME => _($this>plugins[]>DisplayName);
function getAllUsedServices() { $ret = array(); foreach ($this->plugins as $name => $obj) { if ($obj->is_account) { if (isset($obj->DisplayName)) { $ret[$name] = $obj->DisplayName; } else { $ret[$name] = $name; } } } return $ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function get_services() {\n\t\treturn [\n\t\t\tServices\\Language_Loader::class,\n\t\t\tServices\\Setup_Database::class,\n\t\t\tServices\\Scripts_And_Templates::class,\n\t\t\tServices\\Admin_Pages::class,\n\t\t\tServices\\Setup_Settings_Page::class,\n\t\t\tServices\\Loggers_Loader::class,\n\t\t\tServices\\Dropins_Loader::class,\n\t\t\tServices\\Setup_Log_Filters::class,\n\t\t\tServices\\Setup_Pause_Resume_Actions::class,\n\t\t\tServices\\Setup_Purge_DB_Cron::class,\n\t\t\tServices\\API::class,\n\t\t\tServices\\Dashboard_Widget::class,\n\t\t\tServices\\Network_Menu_Items::class,\n\t\t\tServices\\Plugin_List_Link::class,\n\t\t];\n\t}", "function getAllUnusedServices()\n {\n $tmp = $this->getAllUsedServices();\n $pool_of_ocs = array();\n foreach ($tmp as $name => $value) {\n $pool_of_ocs[] = get_class($this->plugins[$name]);\n if (isset($this->plugins[$name]->conflicts)) {\n $pool_of_ocs = array_merge($pool_of_ocs, $this->plugins[$name]->conflicts);\n }\n }\n\n $ret = array();\n foreach ($this->plugins as $name => $obj) {\n if (!$obj->acl_is_createable()) {\n continue;\n }\n\n /* Skip all pluigns that will lead into conflicts */\n $conflicts = array();\n if (isset($obj->conflicts)) {\n $conflicts = $obj->conflicts;\n }\n $conflicts[] = get_class($obj);\n if (count(array_uintersect($conflicts, $pool_of_ocs, \"strcasecmp\"))) {\n continue;\n }\n\n if (isset($obj->DisplayName)) {\n $ret[$name] = $obj->DisplayName;\n } else {\n $ret[$name] = $name;\n }\n }\n return $ret;\n }", "public static function get_services() {\n return [ \n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\SettingsLinks::class,\n Base\\JsObjectsManager::class,\n Base\\ShortCodesManager::class\n ];\n }", "public static function get_services()\n {\n return [\n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\CustomPostType::class,\n Base\\CustomMetaBox::class,\n Base\\Shortcode::class,\n Base\\Cron::class,\n ];\n }", "public function getServices();", "public function getServices(): array;", "public function getServices() {\n $serviceNames = $this->getServiceNames($this->serviceFolderPaths);\n $ret = $ret1 = array();\n// require_once AMFPHP_ROOTPATH.'Plugins/AmfphpDiscovery/CReflection.php';\n foreach ($serviceNames as $serviceName) {\n/* $methods = array();\n $objC = new CReflection(APP_PATH.'/app/controllers/'.$serviceName.'.php');\n $objComment = $objC->getDocComment();\n $arrMethod = $objC->getMethods();\n foreach ($arrMethod as $objMethods)\n {\n $methodComment = $objMethods->getDocComment();\n $parsedMethodComment = $this->parseMethodComment($methodComment);\n $arrParamenter = $objMethods->getParameters();\n foreach ($arrParamenter as $Paramenter)\n {\n $parameterInfo = new AmfphpDiscovery_ParameterDescriptor($Paramenter, '');\n $parameters[] = $parameterInfo;\n }\n $methods[$objMethods->_name] = new AmfphpDiscovery_MethodDescriptor($objMethods->_name, $parameters, $methodComment, $parsedMethodComment['return']);\n }\n\n $ret[$serviceName] = new AmfphpDiscovery_ServiceDescriptor($serviceName, $methods, $objComment); */\n $ret1[] = array('label'=>$serviceName,'date'=>'');\n }\n// var_dump($ret);exit();\n //note : filtering must be done at the end, as for example excluding a Vo class needed by another creates issues\n foreach ($ret as $serviceName => $serviceObj) {\n foreach (self::$excludePaths as $excludePath) {\n if (strpos($serviceName, $excludePath) !== false) {\n unset($ret[$serviceName]);\n break;\n }\n }\n }\n return $ret1;\n }", "public function findServices(): array;", "public function listPlugin()\n\t{\n\t\t\n\t}", "public static function get_services()\n {\n return [\n Pages\\Dashboard::class,\n Base\\Enqueue::class,\n Base\\SettingsLink::class,\n Base\\CustomPostTypeController::class,\n ];\n }", "public static function get_services()\n {\n\n //підключаємо всі необхідні класи для активації через масив\n return [\n Pages\\Admin::class,\n Base\\Enqueue::class,\n Base\\SettingsLinks::class\n ];\n }", "public static function getListServices () {\n return self::findByStatus(self::STATUS_ACTIVE);\n }", "public static function get_services(): array\n {\n return [\n Base\\SettingsLinks::class,\n Pages\\Admin::class,\n Base\\Enqueue::class,\n CPT\\EmailCpt::class,\n ];\n }", "public function getServices()\n\t{\n\t\treturn ['card', 'topup_mobile', 'topup_mobile_post', 'topup_game'];\n\t}", "public function getPlugins()\n {\n return $this->getService('plugins');\n }", "function get_recommender_services_list() {\n global $CFG;\n\n static $services = array();\n\n // see if we have run it already\n if (!empty($services)) {\n return $services;\n }\n\n $servicesdir = $CFG->dirroot.'/blocks/recommender/services/';\n\n $plugins = get_list_of_plugins('', '', $servicesdir);\n\n foreach ($plugins as $plugin) {\n $servicefile = $servicesdir . $plugin. '/lib.php';\n if (is_readable($servicefile)) {\n include_once($servicefile);\n $serviceclass = 'block_recommender_service_' . $plugin;\n if (class_exists($serviceclass)) {\n $services[] = $plugin;\n } else {\n throw new block_recommender_exception(get_string('errorcallingservice',\n 'block_recommender', $plugin));\n }\n } else {\n throw new block_recommender_exception(get_string('errornosuchservice',\n 'block_recommender', $plugin));\n }\n }\n\n return $services;\n}", "public function services(): array\n {\n return \\array_merge(\n \\array_keys($this->_services),\n \\array_keys($this->aliases)\n );\n }", "private function plugins(){\n $all_plugins = explode(',', json_decode(file_get_contents($this->pluginsJson))->all->names);\n debug($all_plugins);\n die;\n }", "function _getPluginControllerNames() {\n \t\tApp::import('Core', 'File', 'Folder');\n \t\t$paths = Configure::getInstance();\n \t\t$folder =& new Folder();\n \t\t$folder->cd(APP . 'plugins');\n\n \t\t// Get the list of plugins\n \t\t$Plugins = $folder->read();\n \t\t$Plugins = $Plugins[0];\n \t\t$arr = array();\n\n \t\t// Loop through the plugins\n \t\tforeach($Plugins as $pluginName) {\n \t\t\t// Change directory to the plugin\n \t\t\t$didCD = $folder->cd(APP . 'plugins'. DS . $pluginName . DS . 'controllers');\n \t\t\t// Get a list of the files that have a file name that ends\n \t\t\t// with controller.php\n \t\t\t$files = $folder->findRecursive('.*_controller\\.php');\n\n \t\t\t// Loop through the controllers we found in the plugins directory\n \t\t\tforeach($files as $fileName) {\n \t\t\t\t// Get the base file name\n \t\t\t\t$file = basename($fileName);\n\n \t\t\t\t// Get the controller name\n \t\t\t\t$file = Inflector::camelize(substr($file, 0, strlen($file)-strlen('_controller.php')));\n \t\t\t\tif (!preg_match('/^'. Inflector::humanize($pluginName). 'App/', $file)) {\n \t\t\t\t\tif (!App::import('Controller', $pluginName.'.'.$file)) {\n \t\t\t\t\t\tdebug('Error importing '.$file.' for plugin '.$pluginName);\n \t\t\t\t\t} else {\n \t\t\t\t\t\t/// Now prepend the Plugin name ...\n \t\t\t\t\t\t// This is required to allow us to fetch the method names.\n \t\t\t\t\t\t$arr[] = Inflector::humanize($pluginName) . \"/\" . $file;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $arr;\n \t}", "public function listAllAvailableServices()\n {\n\t\t$data = $this->call(array(), \"GET\", \"sensors/services/available.json\");\n\t\t$data = $data->{'services'};\n\t\t$serviceArray = new ArrayObject();\n\t\tfor($i = 0; $i<count($data);$i++){\n\t\t\t$serviceArray->append(new Service($data[$i], $this));\n\t\t}\n\t\treturn $serviceArray;\n }", "protected function get_service_classes(): array {\n\t\treturn [];\n\t}", "public function getAvailableServices();", "public static function getServices(): array\n {\n return static::$services;\n }", "public function getLoadedPluginsName()\n\t{\n\t\t$oPlugins = $this->getLoadedPlugins();\n\t\t$pluginNames = array_map('get_class',$oPlugins);\n\t\treturn $pluginNames;\n\t}", "public function getServices()\n {\n return $this->pantonoServices;\n }", "public function getPluginNames() : array\n {\n $names = array();\n \n if( count( $this->plugins ) > 0 )\n {\n foreach( $this->plugins as $plugin )\n {\n $names[] = $plugin->getName();\n }\n }\n return $names;\n }", "static function getServiceList()\n {\n return session::get('ServerService');\n }", "function get_all_plugin_names(array $types) {\n $pluginman = core_plugin_manager::instance();\n $returnarray = array();\n foreach ($types as $type) {\n // Get all plugins of a given type.\n $pluginarray = $pluginman->get_plugins_of_type($type);\n // Plugins will be returned as objects so get the name of each and push it into a new array.\n foreach ($pluginarray as $plugin) {\n array_push($returnarray, $plugin->name);\n }\n }\n return $returnarray;\n}", "function _getPluginControllerNames() {\n\t\tApp::import('Core', 'File', 'Folder');\n\t\t$paths = Configure::getInstance();\n\t\t$folder =& new Folder();\n\t\t$folder->cd(APP . 'plugins');\n\t\t// Get the list of plugins\n\t\t$Plugins = $folder->read();\n\t\t$Plugins = $Plugins[0];\n\t\t$arr = array();\n\t\t// Loop through the plugins\n\t\tforeach($Plugins as $pluginName) {\n\t\t\t// Change directory to the plugin\n\t\t\t$didCD = $folder->cd(APP . 'plugins'. DS . $pluginName . DS . 'controllers');\n\t\t\t// Get a list of the files that have a file name that ends\n\t\t\t// with controller.php\n\t\t\t$files = $folder->findRecursive('.*_controller\\.php');\n\t\t\t// Loop through the controllers we found in the plugins directory\n\t\t\tforeach($files as $fileName) {\n\t\t\t\t// Get the base file name\n\t\t\t\t$file = basename($fileName);\n\t\t\t\t// Get the controller name\n\t\t\t\t$file = Inflector::camelize(substr($file, 0, strlen($file)-strlen('_controller.php')));\n\t\t\t\tif (!preg_match('/^'. Inflector::humanize($pluginName). 'App/', $file)) {\n\t\t\t\t\tif (!App::import('Controller', $pluginName.'.'.$file)) {\n\t\t\t\t\t\tdebug('Error importing '.$file.' for plugin '.$pluginName);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/// Now prepend the Plugin name ...\n\t\t\t\t\t\t// This is required to allow us to fetch the method names.\n\t\t\t\t\t\t$arr[] = Inflector::humanize($pluginName) . \"/\" . $file;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $arr;\n\t}", "public function getServices()\n {\n return $this->services;\n }" ]
[ "0.7040355", "0.6973125", "0.6946765", "0.6926431", "0.691777", "0.6877789", "0.6796921", "0.67913777", "0.6765748", "0.6726817", "0.6630286", "0.6595965", "0.6578168", "0.6510909", "0.6510546", "0.6507702", "0.64790314", "0.64664596", "0.6432358", "0.6424015", "0.6406699", "0.6380597", "0.6376083", "0.63524693", "0.63413525", "0.63306975", "0.6329073", "0.6327995", "0.63012683", "0.62927073" ]
0.83596385
0
/! \brief Returns a list of all unused services.
function getAllUnusedServices() { $tmp = $this->getAllUsedServices(); $pool_of_ocs = array(); foreach ($tmp as $name => $value) { $pool_of_ocs[] = get_class($this->plugins[$name]); if (isset($this->plugins[$name]->conflicts)) { $pool_of_ocs = array_merge($pool_of_ocs, $this->plugins[$name]->conflicts); } } $ret = array(); foreach ($this->plugins as $name => $obj) { if (!$obj->acl_is_createable()) { continue; } /* Skip all pluigns that will lead into conflicts */ $conflicts = array(); if (isset($obj->conflicts)) { $conflicts = $obj->conflicts; } $conflicts[] = get_class($obj); if (count(array_uintersect($conflicts, $pool_of_ocs, "strcasecmp"))) { continue; } if (isset($obj->DisplayName)) { $ret[$name] = $obj->DisplayName; } else { $ret[$name] = $name; } } return $ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listAllAvailableServices()\n {\n\t\t$data = $this->call(array(), \"GET\", \"sensors/services/available.json\");\n\t\t$data = $data->{'services'};\n\t\t$serviceArray = new ArrayObject();\n\t\tfor($i = 0; $i<count($data);$i++){\n\t\t\t$serviceArray->append(new Service($data[$i], $this));\n\t\t}\n\t\treturn $serviceArray;\n }", "public function getAvailableServices();", "function getAllUsedServices()\n {\n $ret = array();\n foreach ($this->plugins as $name => $obj) {\n if ($obj->is_account) {\n if (isset($obj->DisplayName)) {\n $ret[$name] = $obj->DisplayName;\n } else {\n $ret[$name] = $name;\n }\n }\n }\n return $ret;\n }", "public function getAvailableServices()\n {\n return array_keys($this->_servicesConfig);\n }", "public static function getListServices () {\n return self::findByStatus(self::STATUS_ACTIVE);\n }", "protected function getInstalledServices() {}", "public function getServices();", "protected function getInstalledServices()\n {\n $filteredServices = [];\n foreach ($GLOBALS['T3_SERVICES'] as $serviceType => $serviceList) {\n // If the (first) key of the service list is not the same as the service type,\n // it's a \"true\" service type. Keep it and sort it.\n if (key($serviceList) !== $serviceType) {\n uasort($serviceList, [$this, 'sortServices']);\n $filteredServices[$serviceType] = $serviceList;\n }\n }\n return $filteredServices;\n }", "static function getServiceList()\n {\n return session::get('ServerService');\n }", "function getServices() {\n\t\t$results = \"\";\n\t\t$sql = 'SELECT * FROM Service';\n\n\t\t$results = queryDB($sql);\n\n\t\treturn $results;\n\t}", "public function getRemainingServicesByName() {\n $term = Request::input('term', '');\n $ids = Request::input('ids', '');\n $services_id = ($ids ? array_map('intval', explode(',', $ids)) : []);\n\n $results = array();\n $queries = Service::where('name', 'LIKE', '%'.$term.'%')\n ->whereNotIn('id', $services_id)\n ->take(10)->get();\n foreach ($queries as $query)\n $results[] = ['id' => $query->id,\n 'value' => $query->name,\n 'price' => $query->price];\n return response()->json($results);\n }", "public function getServices()\n {\n return $this->services;\n }", "public function getServices()\n {\n return $this->services;\n }", "public function getServices()\n {\n return $this->services;\n }", "public function services($ignore_cache = false) {\n if ($this->services === null || $ignore_cache) {\n $this->services = StatusBoard_Service::allForSite($this);\n }\n \n return $this->services;\n }", "protected function getServices()\n {\n return $this->services;\n }", "public function getServices(): array;", "public function getServices() {\n return $this->services;\n }", "public function getServices() {\n return $this->services;\n }", "public function &getServices(): array {\n return $this->services;\n }", "public function getServices()\n {\n return $this->pantonoServices;\n }", "public function getServices() {\n\n return $this->services;\n\n }", "private function get_services() {\n\t\treturn [\n\t\t\tServices\\Language_Loader::class,\n\t\t\tServices\\Setup_Database::class,\n\t\t\tServices\\Scripts_And_Templates::class,\n\t\t\tServices\\Admin_Pages::class,\n\t\t\tServices\\Setup_Settings_Page::class,\n\t\t\tServices\\Loggers_Loader::class,\n\t\t\tServices\\Dropins_Loader::class,\n\t\t\tServices\\Setup_Log_Filters::class,\n\t\t\tServices\\Setup_Pause_Resume_Actions::class,\n\t\t\tServices\\Setup_Purge_DB_Cron::class,\n\t\t\tServices\\API::class,\n\t\t\tServices\\Dashboard_Widget::class,\n\t\t\tServices\\Network_Menu_Items::class,\n\t\t\tServices\\Plugin_List_Link::class,\n\t\t];\n\t}", "public function getServices()\n\t{\n\t\treturn ['card', 'topup_mobile', 'topup_mobile_post', 'topup_game'];\n\t}", "function get_service_list() {\n\t\tglobal $wpdb;\n\t\t\n\t\t$services = $wpdb->get_results( \n\t\t\t\"\n\t\t\tSELECT ID, Title\n\t\t\tFROM cp_Categories\n\t\t\tWHERE 1\n\t\t\t\",\n\t\t\tARRAY_A\n\t\t);\n\t\t\n\t\treturn $services;\n\t}", "protected function getServicesList()\n {\n $servicesList = [];\n $services = $this->getInstalledServices();\n foreach ($services as $serviceType => $installedServices) {\n $servicesList[] = $this->getServiceTypeList($serviceType, $installedServices);\n }\n return $servicesList;\n }", "public function getRequestedServices();", "public static function getServices(): array\n {\n return static::$services;\n }", "public function findServices(): array;", "function AllServices(){\n return $this->db->get($this->service)->result();\n }" ]
[ "0.73377377", "0.722843", "0.69160146", "0.6892129", "0.6772187", "0.66971886", "0.65814096", "0.63706046", "0.63466865", "0.633627", "0.6324876", "0.63051397", "0.63051397", "0.63051397", "0.630276", "0.6280854", "0.6279807", "0.62582827", "0.62582827", "0.6201976", "0.6189653", "0.618466", "0.6181692", "0.6155454", "0.61208725", "0.61176497", "0.6102509", "0.60744953", "0.6062851", "0.6045852" ]
0.77746826
0
__construct() Get this object CSprite instance.
public function getCSprite() { return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct()\n\t{\n\t\t$this->game = new BowlingGame;\n\t}", "public function __construct()\n {\n $this->cpu = new CPU();\n $this->player = new Player();\n }", "public function construct()\n {\n return $this->object;\n }", "public function getCSprite()\n {\n return $this->spriteImageRegistry->getCSprite();\n }", "public function __construct($name = 'default')\n {\n $this->name = $name;\n $this->spriteTemplateRegistry = new SpriteTemplateRegistry($this);\n $this->spriteImageRegistry = new SpriteImageRegistry($this);\n $this->spriteStyleRegistry = new SpriteStyleRegistry($this);\n $this->spriteConfig = CSpriteConfig::getInstance($name);\n $this->spriteCache = new SpriteCache($this);\n\n if (!isset(self::$instances))\n {\n self::$instances = array();\n }\n self::$instances[$name] = $this;\n }", "public function construct()\n\t\t{\n\t\t}", "public function construct() {\n\n }", "function __construct() {\n //$objCore = new Core();\n //default constructor for this class\n }", "public function __construct() {\n\t\tparent::__construct();\n\t\t// Other code to run when object is instantiated\n\t}", "function __constructor(){}", "function _construct(){ }", "public function __construct() {\n\t\t\trequire_once('classes/canvasWrapper.php');\n\t\t\t$this->canvas = new CanvasWrapper();\n\t\t\t\n\t\t\t$this->db = Db::getInstance();\n\t\t\t\n\t\t}", "public function __construct()\n\t{\n\t\t\n\t\t// Set the super object to a local variable for use throughout the class\n\t\t$this->CI =& get_instance();\n\t}", "public function __construct()\n {\n $this->dice = new DiceImage();\n $this->resetVariables();\n }", "public function __construct()\n {\n $this->dice = new DiceImage();\n $this->resetVariables();\n }", "public function __construct()\n {\n $this->climate = new CLImate;\n }", "function _construct() {\n \t\n\t\t\n\t}", "function __construct()\n {\n\n //$objCore = new Core();\n //default constructor for this class\n }", "public function __construct(SpriteImageRegistry &$spriteImageRegistry)\n {\n $this->spriteImageRegistry = $spriteImageRegistry;\n }", "public function __construct()\n\t{\n\t\tself::init();\n\t}", "public function __construct(){\n\t\t\n\t\t$this->dataMgr = createNewDataManager();\n\t\t$this->player = null;\n\t}", "public function __construct()\n {\n return $this->drone = new Drone;\n }", "public function __construct() {\n //$objCore = new Core();\n //default constructor for this class\n }", "function __construct() ;", "public function __construct()\n\t{\n\t\tself::$instance =& $this;\n\t}", "public function __construct()\n\t\t{\n\t\t\t# code...\n\t\t}", "public function __construct()\n\t{\n\t\t$this->games = Games::getGames();\t\n\t}", "function __construct()\n\t{\n\t\t# code...\n\t}", "public function __construct()\n {\n if (!self::$instance) {\n self::$instance = $this;\n //echo \"Create new object\";\n return self::$instance;\n } else {\n //echo \"Return old object\";\n return self::$instance;\n }\n }", "function __construct() {}" ]
[ "0.65402466", "0.6528637", "0.62953895", "0.6264603", "0.6146216", "0.6129432", "0.6119235", "0.6110909", "0.6062796", "0.606225", "0.6047425", "0.6018409", "0.59744364", "0.59674585", "0.59674585", "0.59620947", "0.5959209", "0.5950519", "0.59475416", "0.590886", "0.5896933", "0.58898824", "0.58884805", "0.58781457", "0.58700264", "0.58697075", "0.5869453", "0.58662647", "0.58573544", "0.58566624" ]
0.719942
0
getCSprite() Get this instance configuration.
public function getSpriteConfig() { return $this->spriteConfig; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCSprite()\n {\n return $this->spriteImageRegistry->getCSprite();\n }", "public function getSpriteConfig()\n {\n return $this->spriteImageRegistry->getSpriteConfig();\n }", "public function getCSprite()\n {\n return $this;\n }", "public function getSpriteCache()\n {\n return $this->spriteCache;\n }", "public function getConfig() : \\codename\\core\\config {\r\n return $this->config;\r\n }", "public static function getInstance() {\n return self::getConfig();\n }", "public static function getConfig() {\n if (!self::$_configInstance)\n new acs_config();\n \n return self::$_configInstance;\n }", "public static function getConfig()\n {\n return self::$config;\n }", "public function getConfig()\n {\n return $this['config'];\n }", "public function get()\r\n {\r\n $this->ensureLoaded();\r\n return $this->config;\r\n }", "public function getConfig(){\n return $this->config;\n }", "function getConfig()\n {\n return $this->config;\n }", "static public function getConfig() {\n if (self::$config === null) {\n self::$config = JComponentHelper::getParams('com_bullhorn')->toObject();\n }\n return self::$config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getSpriteCache()\n {\n return $this->spriteImageRegistry->getSpriteCache();\n }", "public function getConfig() \n {\n return $this->config;\n }", "public function getConfig(){\n\t\treturn $this->_config;\n\t}", "public function getConfig() {\r\n return $this->config;\r\n }", "protected function &getConfig(){\n \n if( is_null($this->config) ){\n $this->config = new \\stdClass();\n }\n \n return $this->config;\n \n }", "public function get_config()\n\t{\n\t\treturn $this->cfg;\n\t}", "public function config()\n\t{\n\t\treturn $this->config;\n\t}", "public function config()\n\t{\n\t\treturn $this->config;\n\t}", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }", "public function getConfig()\n {\n return $this->config;\n }" ]
[ "0.73720866", "0.7350156", "0.7312734", "0.5723863", "0.57031745", "0.560343", "0.56013554", "0.55858415", "0.5556608", "0.5545413", "0.55231106", "0.5475459", "0.5456261", "0.54552394", "0.5450682", "0.54487634", "0.5442738", "0.54408145", "0.5425102", "0.5394908", "0.5382063", "0.5382063", "0.53818387", "0.53818387", "0.53818387", "0.53818387", "0.53818387", "0.53818387", "0.53818387", "0.53818387" ]
0.75944084
0
getName() Get the template registry.
public function getTemplateRegistry() { return $this->spriteTemplateRegistry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTemplateName() {\n\t\treturn $this->templateName;\n\t}", "public function getRegisterTpl(){\n return $this->templates['register'];\n }", "public function getTemplateName()\n {\n return $this->templateName;\n }", "public function getTemplateName()\n {\n }", "public function getName()\r\n\t{\r\n\t\treturn GeekPoint_AdminDAVi_Directory_Root::ADMIN_TEMPLATES;\r\n\t}", "public function getTemplateName(): string;", "public function getTemplateName()\n {\n return $this->_sThisTemplate;\n }", "public function getTemplateName()\n {\n return isset($this->TemplateName) ? $this->TemplateName : null;\n }", "public function getTemplateNames() {\n\t\treturn array_keys(self::$_config->template->toArray());\n\t}", "public function render()\n {\n return $this->getTemplateName();\n }", "public function getInspectTemplateName()\n {\n return $this->inspect_template_name;\n }", "abstract public function getTemplateName();", "public function getReidentifyTemplateName()\n {\n return $this->reidentify_template_name;\n }", "public function getTemplate($name){\n if(isset($name)){\n return $this->template[$name]; // $this->envir->loadTemplate($template)\n }\n return $this->template[$this->templace_interator++]; // $this->envir->loadTemplate($template)\n }", "function getName () {\n\t\treturn $this->name;\n\t}", "public function get()\n {\n return $this->templates;\n }", "public function getTemplatePathname() : string {\n\t\treturn $this->templateBasePath . '/linklist-group.mustache';\n\t}", "public function getName ();", "function\tgetName() {\n\t\treturn $this->name ;\n\t}", "function get_name () {\n return $this -> name;\n }", "public function name()\n {\n return $this->getFromCache(\n ['type' => 'name']\n );\n }", "public function getTemplateName() {\n\t\treturn 'uitypes/Tree.tpl';\n\t}", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();", "public function getName();" ]
[ "0.6642682", "0.6521775", "0.63660914", "0.6331903", "0.6254645", "0.624497", "0.61934227", "0.6114543", "0.61105937", "0.6086938", "0.6056717", "0.6048571", "0.6037646", "0.60367525", "0.6007794", "0.5991045", "0.599049", "0.5974496", "0.5973275", "0.59590894", "0.59392494", "0.5924996", "0.5921438", "0.5921438", "0.5921438", "0.5921438", "0.5921438", "0.5921438", "0.5921438", "0.5921438" ]
0.68292594
0
getTemplateRegistry() Get the image registry.
public function getImageRegistry() { return $this->spriteImageRegistry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTemplateRegistry()\n {\n return $this->spriteTemplateRegistry;\n }", "public function registry()\n {\n if(!$this->defaultRegistry) {\n $this->defaultRegistry = $this('registry');\n }\n\n return $this->defaultRegistry;\n }", "public function &get_registry()\n {\n }", "public function getMainRegistry()\n {\n return $this->registry;\n }", "public function getRegistryArray() {\n return $this->_registryArray;\n }", "public function getPathRegistry() {\n if (null == $this->pathRegistry) {\n $this->pathRegistry = new PathRegistry();\n }\n\n return $this->pathRegistry;\n }", "public function getSpriteImageRegistry()\n {\n return $this->spriteImageRegistry;\n }", "static function getRegistry() {\n\t\tif ( self::$_Registry === false ) {\n\t\t\tself::$_Registry = new systemRegistry();\n\t\t}\n\t\treturn self::$_Registry;\n\t}", "public static function registry()\n {\n\t\tif ( empty(self::$registry) ){\n\t\t\tself::$registry = new Registry();\n\t\t}\n\t\treturn self::$registry;\n\n }", "public function loadRegistry();", "public static function getRegistry(): CacheRegistry\n {\n return static::$_registry ??= new CacheRegistry();\n }", "protected function getExtractorRegistry() {}", "public function getRegisterTpl(){\n return $this->templates['register'];\n }", "public function getRegistryData()\n {\n return array();\n }", "public static function get_type_registry()\n {\n }", "public function getSutRegistry() {\n if (null == $this->sutRegistry) {\n $this->sutRegistry = new SutRegistry();\n }\n\n return $this->sutRegistry;\n }", "public function getImageTemplate() { return $this->imageTemplate; }", "protected function getRegistryProcessor()\n {\n return $this->registryProcessor;\n }", "protected function getRegistryProcessor()\n {\n return $this->registryProcessor;\n }", "public function dump()\n {\n return $this->registry;\n }", "protected function getRegistryLoader()\n {\n return $this->registryLoader;\n }", "public function getStyleRegistry()\n {\n return $this->spriteStyleRegistry;\n }", "public static function getExpanderRegistry() {\n return self::$dynamic_mixins;\n }", "protected function getRegistry() {\r\n if (!isset($this -> mReg)) {\r\n $this -> mReg = new CApp_Event_Action_Registry();\r\n }\r\n }", "protected function getRegistryProcessor() : RegistryProcessorInterface\n {\n return $this->registryProcessor;\n }", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();" ]
[ "0.79117835", "0.648659", "0.63764477", "0.63603956", "0.63342166", "0.62918615", "0.6244733", "0.61262417", "0.6096462", "0.58326966", "0.58079904", "0.57800484", "0.57171875", "0.5639005", "0.5637214", "0.5611751", "0.5580527", "0.5562324", "0.5562324", "0.55464685", "0.55295885", "0.55250776", "0.55152607", "0.5469961", "0.5404298", "0.5285199", "0.5285199", "0.5285199", "0.5285199", "0.5285199" ]
0.69325733
1
getImageRegistry() Get the style registry.
public function getStyleRegistry() { return $this->spriteStyleRegistry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getImageRegistry()\n {\n return $this->spriteImageRegistry;\n }", "public function getSpriteImageRegistry()\n {\n return $this->spriteImageRegistry;\n }", "public function getTemplateRegistry()\n {\n return $this->spriteTemplateRegistry;\n }", "public function getRegistryArray() {\n return $this->_registryArray;\n }", "public function &get_registry()\n {\n }", "public function getPathRegistry() {\n if (null == $this->pathRegistry) {\n $this->pathRegistry = new PathRegistry();\n }\n\n return $this->pathRegistry;\n }", "public function getMainRegistry()\n {\n return $this->registry;\n }", "public static function getRegistry(): CacheRegistry\n {\n return static::$_registry ??= new CacheRegistry();\n }", "public static function getExpanderRegistry() {\n return self::$dynamic_mixins;\n }", "public function registry()\n {\n if(!$this->defaultRegistry) {\n $this->defaultRegistry = $this('registry');\n }\n\n return $this->defaultRegistry;\n }", "static function getRegistry() {\n\t\tif ( self::$_Registry === false ) {\n\t\t\tself::$_Registry = new systemRegistry();\n\t\t}\n\t\treturn self::$_Registry;\n\t}", "public static function registry()\n {\n\t\tif ( empty(self::$registry) ){\n\t\t\tself::$registry = new Registry();\n\t\t}\n\t\treturn self::$registry;\n\n }", "public static function get_type_registry()\n {\n }", "static public function getCSS() {\n\t\treturn self::$css;\n\t}", "public static function getRegister(): array\n {\n return self::$smartObjectRegistry;\n }", "public function getStyleModules() {\n\t\treturn [];\n\t}", "public static function getCss() {\n return self::get('_css', array());\n }", "public function loadRegistry();", "protected function get_styles()\n\t{\n\t\t$sql = 'SELECT style_id, style_path, style_parent_id, bbcode_bitfield FROM ' . $this->styles_table;\n\n\t\treturn $this->fetch_decoded_rowset($sql);\n\t}", "function get_editor_stylesheets()\n {\n }", "public function getStyleSheets()\n {\n return $this->style_sheets;\n }", "public function getRegistryData()\n {\n return array();\n }", "protected function getRegistryProcessor()\n {\n return $this->registryProcessor;\n }", "protected function getRegistryProcessor()\n {\n return $this->registryProcessor;\n }", "public function get_styles() {\n\t\treturn [];\n\t}", "public function getCurrentImagesSettings()\n {\n $currentSkinModule = \\XLite\\Core\\Database::getRepo('XLite\\Model\\Module')\n ->getCurrentSkinModule();\n\n $skinModuleName = $currentSkinModule && $currentSkinModule->getActualName() !== \"XC\\ColorSchemes\"\n ? $currentSkinModule->getActualName()\n : 'default';\n\n return \\XLite\\Core\\Database::getRepo('XLite\\Model\\ImageSettings')\n ->findByModuleName($skinModuleName);\n }", "protected function getGlobalShortcutGroups() {}", "public function getStylesheets()\n {\n return array('/sfEntityAttributeValuePlugin/css/jquery.formbuilder.css' => 'all');\n }", "function wp_get_global_stylesheet($types = array())\n {\n }", "protected function getRegistry() {\r\n if (!isset($this -> mReg)) {\r\n $this -> mReg = new CApp_Event_Action_Registry();\r\n }\r\n }" ]
[ "0.7306808", "0.6684028", "0.6571037", "0.6259464", "0.618814", "0.600374", "0.59624726", "0.5875376", "0.5873722", "0.5839037", "0.5703135", "0.5633389", "0.5621689", "0.54181725", "0.53901887", "0.53840905", "0.53783303", "0.5371194", "0.5368176", "0.5363021", "0.53401476", "0.5327111", "0.5325028", "0.5325028", "0.52990115", "0.5269084", "0.5261841", "0.5229509", "0.5215876", "0.51995283" ]
0.8072847
0
registerTemplate() Get the SpriteStyleNode for the given image path.
public function getStyleNode($path) { $node = $this->spriteStyleRegistry->getStyleNode($path); if(! $node) { throw new SpriteException(sprintf('Error: no node found for path "%s". Available nodes are: %s.', $path, implode(', ', $this->spriteStyleRegistry->getStyleNodesPaths())), 102); } return $node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTemplateRegistry()\n {\n return $this->spriteTemplateRegistry;\n }", "public function getImageTemplate() { return $this->imageTemplate; }", "abstract public function getTemplate();", "function getTemplate();", "function get_template()\n {\n }", "public function draw_template($template) {\n\n $name = $template->getName();\n $templateId = $template->getId();\n\n $img_url = plugin_dir_url( dirname(__FILE__) ).\"img/\".$template->getImage();\n\n include Config::VIEW_PATH.\"template.php\";\n }", "public function getStyleRegistry()\n {\n return $this->spriteStyleRegistry;\n }", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "function s2_get_template($rawTemplateId, $defaultPath = false)\n{\n global $request_uri;\n\n if ($defaultPath === false) {\n $defaultPath = S2_ROOT . '_include/templates/';\n }\n\n $path = false;\n $templateId = preg_replace('#[^0-9a-zA-Z\\._\\-]#', '', $rawTemplateId);\n\n $return = ($hook = s2_hook('fn_get_template_start')) ? eval($hook) : null;\n if ($return) {\n return $return;\n }\n\n if (!$path) {\n if (file_exists(S2_ROOT . '_styles/' . S2_STYLE . '/templates/' . $templateId)) {\n $path = S2_ROOT . '_styles/' . S2_STYLE . '/templates/' . $templateId;\n } elseif (file_exists($defaultPath . $templateId)) {\n $path = $defaultPath . $templateId;\n } else {\n throw new Exception(sprintf(Lang::get('Template not found'), $defaultPath . $templateId));\n }\n }\n\n ob_start();\n include $path;\n $template = ob_get_clean();\n\n $style_filename = '_styles/' . S2_STYLE . '/' . S2_STYLE . '.php';\n $assetPack = require S2_ROOT . $style_filename;\n\n if (!($assetPack instanceof \\S2\\Cms\\Asset\\AssetPack)) {\n throw new Exception(sprintf('File \"%s\" must return an AssetPack object.', $style_filename));\n }\n\n ($hook = s2_hook('fn_get_template_pre_includes_merge')) ? eval($hook) : null;\n\n $styles = $assetPack->getStyles(\n S2_PATH . '/_styles/' . S2_STYLE . '/',\n new \\S2\\Cms\\Asset\\AssetMerge(S2_CACHE_DIR, '/_cache/', S2_STYLE . '_styles.css', \\S2\\Cms\\Asset\\AssetMerge::FILTER_CSS, defined('S2_DEBUG'))\n );\n $scripts = $assetPack->getScripts(\n S2_PATH . '/_styles/' . S2_STYLE . '/',\n new \\S2\\Cms\\Asset\\AssetMerge(S2_CACHE_DIR, '/_cache/', S2_STYLE . '_scripts.js', \\S2\\Cms\\Asset\\AssetMerge::FILTER_JS, defined('S2_DEBUG'))\n );\n\n $template = str_replace(['<!-- s2_styles -->', '<!-- s2_scripts -->'], [$styles, $scripts], $template);\n\n if ((strpos($template, '</a>') !== false) && isset($request_uri)) {\n $template = preg_replace_callback('#<a href=\"([^\"]*)\">([^<]*)</a>#',\n static function ($matches) use ($request_uri) {\n $real_request_uri = s2_link($request_uri);\n\n [, $url, $text] = $matches;\n\n if ($url == $real_request_uri) {\n return '<span>' . $text . '</span>';\n }\n\n if ($url && strpos($real_request_uri, $url) === 0) {\n return '<a class=\"current\" href=\"' . $url . '\">' . $text . '</a>';\n }\n\n return '<a href=\"' . $url . '\">' . $text . '</a>';\n },\n $template\n );\n }\n\n ($hook = s2_hook('fn_get_template_end')) ? eval($hook) : null;\n return $template;\n}", "abstract public function getTemplate($tpl);", "private function _processTemplate(\\DOMNode $node, array $path = [/** value is missing */], array &$dataPathCache = [/** value is missing */], $currentDataPath = '') {}", "public function getTemplate() {}", "function register_style() {\n}", "function getTemplateHierarchy($template) {\n\t\t// whether or not .php was added\n\t\t$template_slug = rtrim($template, '.php');\n\t\t$template = $template_slug . '.php';\n\t\t\n\t\tif ( $theme_file = locate_template(array('image-widget/'.$template)) ) {\n\t\t\t$file = $theme_file;\n\t\t} else {\n\t\t\t$file = 'views/' . $template;\n\t\t}\n\t\treturn apply_filters( 'sp_template_image-widget_'.$template, $file);\n\t}", "abstract public function register_style();", "function get_template_name($instance)\n {\n return isset($instance['style']) ? $instance['style'] : 'base';\n }", "function get_template_hierarchy($slug, $is_custom = \\false, $template_prefix = '')\n {\n }", "public function getTemplate(): TemplateInterface;", "function getTemplateHierarchy($template) {\n\t\t// whether or not .php was added\n\t\t$template_slug = rtrim($template, '.php');\n\t\t$template = $template_slug . '.php';\n\n\t\tif ( $theme_file = locate_template(array('social-icons/'.$template)) ) {\n\t\t\t$file = $theme_file;\n\t\t} else {\n\t\t\t$file = 'views/' . $template;\n\t\t}\n\t\treturn apply_filters( 'template_social-icons_'.$template, $file);\n\t}", "function training_image_callback() {\n $output = array();\n $file_path = drupal_realpath('modules/image/sample.png');\n $source = (object) array(\n 'uid' => 1,\n 'uri' => $file_path,\n 'filename' => basename($file_path),\n 'filemime' => file_get_mimetype($file_path),\n );\n $directory = 'public://';\n file_copy($source, $directory, $replace = FILE_EXISTS_REPLACE);\n $array_style = image_styles();\n foreach ($array_style as $val) {\n $style_name = $val['name'];\n $path = 'public://sample.png';\n $attributes = array(\n 'class' => 'simple-image',\n );\n $output[] = theme('image_style', array(\n 'style_name' => $style_name,\n 'path' => $path,\n 'attributes' => $attributes,\n ));\n }\n\n return theme('item_list', array(\n 'items' => $output,\n 'type' => 'ol',\n 'title' => t('Default image styles'),\n ));\n}", "function locate_template( $template, $template_name, $template_path ){\r\n\r\n\t\tswitch( $template_name ){\r\n\r\n\t\t\tcase 'form-fields/term-checklist-field.php':\r\n\t\t\t\twp_enqueue_script( 'jmfe-term-checklist-field' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tif( file_exists( WPJM_FIELD_EDITOR_PLUGIN_DIR . '/templates/' . $template_name ) ){\r\n\t\t\t\t\t$template = WPJM_FIELD_EDITOR_PLUGIN_DIR . '/templates/' . $template_name;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\treturn $template;\r\n\t}", "public function getTemplateNode($fieldName) {}", "function ct_get_template_hierarchy( $template ) {\n \n // Get the template slug\n $template_slug = rtrim( $template, '.php' );//single\n $template = $template_slug . '.php'; //single.php\n\n //logit($template,'$template: ');\n //logit($template_slug,'$template_slug: ');\n\n //$locate = locate_template( array( 'plugin_templates/single.php' ) );\n //$locateString = 'plugin_template/' . $template;\n //logit($locateString,'$locateString: ');\n //logit($locate,'$locate: ');\n \n // Check if a custom template exists in the theme folder, if not, load the plugin template file\n if ( $theme_file = locate_template( array( 'cals_teams_templates/' . $template ) ) ) {\n $file = $theme_file;\n logit($file,'$file: ');\n\n }\n else {\n $file = CT_PLUGIN_BASE_DIR . '/includes/templates/' . $template;\n }\n \n //return apply_filters( 'rc_repl_template_' . $template, $file );\n return $file;\n}", "function get_template($template){\n\n\t\t\t$login_arr = $this->action_parser($this->action,'template') ;\n\n\t\t\t$pos = array_search($template, $login_arr['template']['name']); \n\n\t\t\treturn $login_arr['template']['path'][$pos];\n\n\t\t}", "public function get_template()\n {\n }" ]
[ "0.6140705", "0.5202701", "0.50394803", "0.49838272", "0.49628812", "0.4951277", "0.48921677", "0.48664862", "0.48664862", "0.48664862", "0.48664862", "0.48664862", "0.48664862", "0.48507774", "0.4779319", "0.47376958", "0.47047833", "0.46994162", "0.4658522", "0.4648182", "0.4627001", "0.46258426", "0.46130145", "0.45893902", "0.45685583", "0.45607176", "0.4554145", "0.45442253", "0.45319843", "0.45201784" ]
0.56901944
1
Creates a TSFE object which can be used in Backend
protected function buildTsfe() { if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = $this->getTimeTrackerInstance(); $GLOBALS['TT']->start(); } $GLOBALS['TSFE'] = $this->getTsfeInstance(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->fetch_the_id(); $GLOBALS['TSFE']->getPageAndRootline(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function initTSFE() {\n\t\tif (!is_object($GLOBALS['TSFE'])) {\n\t\t\t$GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], 0, 0, TRUE);\n\t\t\t$GLOBALS['TSFE']->initFEuser();\n\t\t\t$GLOBALS['TSFE']->fetch_the_id();\n\t\t\t$GLOBALS['TSFE']->getPageAndRootline();\n\t\t\t$GLOBALS['TSFE']->initTemplate();\n\t\t\t$GLOBALS['TSFE']->forceTemplateParsing = 1;\n\t\t\t$GLOBALS['TSFE']->getConfigArray();\n\t\t\t$GLOBALS['TSFE']->includeTCA();\n\t\t\t$GLOBALS['TSFE']->newCObj();\n\t\t}\n\t}", "protected function getTsfeInstance() {\n\t\t$tsfeClassname = 'TYPO3\\\\CMS\\\\Frontend\\\\Controller\\\\TypoScriptFrontendController';\n\t\treturn \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance($tsfeClassname,\n\t\t\t$GLOBALS['TYPO3_CONF_VARS'], $this->pid, '0', 1, '', '', '', '');\n\t}", "private static function getTSFE() {}", "function buildTSFE() {\n\t $typeNum = 0 ;\n\t if( $this->pid < 1 ) {\n $this->pid = 1 ;\n }\n\t\tif (!is_object($GLOBALS['TT'])) {\n\t\t\t$GLOBALS['TT'] = new TimeTracker;\n\t\t\tGeneralUtility::makeInstance(TimeTracker::class)->start();\n\t\t}\n/*\n * @param array $_ unused, previously defined to set TYPO3_CONF_VARS\n * @param mixed $id The value of GeneralUtility::_GP('id')\n * @param int $type The value of GeneralUtility::_GP('type')\n * @param bool|string $no_cache The value of GeneralUtility::_GP('no_cache'), evaluated to 1/0, will be unused in TYPO3 v10.0.\n * @param string $cHash The value of GeneralUtility::_GP('cHash')\n * @param string $_2 previously was used to define the jumpURL\n * @param string $MP The value of GeneralUtility::_GP('MP')\n */\n // public function __construct($_ = null, $id, $type, $no_cache = null, $cHash = '', $_2 = null, $MP = '')\n /** @var TypoScriptFrontendController $TSFEclassName */\n $TSFEclassName = GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Frontend\\\\Controller\\\\TypoScriptFrontendController' ,NULL , $this->pid , $typeNum , null , '', '', '') ;\n\t\t$GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'], $this->pid, $typeNum , null , '', '', '', '');\n // note: we need to instantiate the logger manually here since the injection happens after the constructor\n $GLOBALS['TSFE']->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__) ;\n\t\t// $GLOBALS['TSFE']->fetch_the_id();\n\n\t\t// done already in fetch the ID\n\t//\t$GLOBALS['TSFE']->getPageAndRootline();\n\t//\t$GLOBALS['TSFE']->initTemplate();\n\t\t$GLOBALS['TSFE']->tmpl->getFileName_backPath = Environment::getPublicPath() . '/';\n\t\tGeneralUtility::makeInstance(Context::class)->setAspect('typoscript', GeneralUtility::makeInstance(TypoScriptAspect::class, true));\n\t\t$GLOBALS['TSFE']->getConfigArray();\n\t}", "protected function initTSFE() {\n\t\t$GLOBALS['TSFE'] = $tsfe = GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Frontend\\\\Controller\\\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], GeneralUtility::_GP('id'), '');\n\t\t/** @var \\TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController $tsfe */\n\t\t$tsfe->connectToDB();\n\t\t$tsfe->initFEuser();\n\t\t\\TYPO3\\CMS\\Frontend\\Utility\\EidUtility::initTCA();\n\t\t$tsfe->determineId();\n\t\t$tsfe->initTemplate();\n\t\t$tsfe->getConfigArray();\n\t\t$tsfe->settingLanguage();\n\n\t\t// Get linkVars, absRefPrefix, etc\n\t\t\\TYPO3\\CMS\\Frontend\\Page\\PageGenerator::pagegenInit();\n\t}", "protected function initTSFE() {\n\t\t$tsfeClassName = t3lib_div::makeInstanceClassName('tslib_fe');\n\n\t\t$GLOBALS['TSFE'] = new $tsfeClassName($GLOBALS['TYPO3_CONF_VARS'], t3lib_div::_GP('id'), '');\n\n\t\t$initCache = !isset($GLOBALS['typo3CacheManager']) && version_compare(TYPO3_branch, '4.3', '>=');\n\t\tif ($initCache) {\n\t\t\trequire_once(PATH_t3lib . 'class.t3lib_cache.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractbackend.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractcache.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_exception.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_factory.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_manager.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/class.t3lib_cache_variablecache.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidbackend.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidcache.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invaliddata.php');\n\t\t\trequire_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');\n\t\t\t$GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');\n\t\t\t$cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');\n\t\t\t$GLOBALS['typo3CacheFactory'] = new $cacheFactoryClass($GLOBALS['typo3CacheManager']);\n\t\t\tunset($cacheFactoryClass);\n\t\t\t$GLOBALS['TSFE']->initCaches();\n\t\t}\n\t\t$GLOBALS['TSFE']->connectToMySQL();\n\t\t$GLOBALS['TSFE']->initFEuser();\n\t\t$GLOBALS['TSFE']->checkAlternativeIdMethods();\n\t\t$GLOBALS['TSFE']->determineId();\n\t\t$GLOBALS['TSFE']->getCompressedTCarray();\n\t\t$GLOBALS['TSFE']->initTemplate();\n\t\t$GLOBALS['TSFE']->getConfigArray();\n\n\t\t// Get linkVars, absRefPrefix, etc\n\t\tTSpagegen::pagegenInit();\n\t}", "protected function getFrontendObject()\n {\n return $GLOBALS['TSFE'];\n }", "public function createLatteEngine()\n {\n $latte = new Latte\\Engine();\n $tmpDir = $this->config->value('tmpDir', 'tmp');\n if ($tmpDir[0] !== '/') {\n $tmpDir = __DIR__ . '/../' . $tmpDir . '/latte';\n }\n $latte->setTempDirectory($tmpDir);\n return $latte;\n }", "private static function engine(): Factory\n {\n if (!(self::$engine instanceof Factory)) {\n $loader = new FileLoader(new Filesystem(), self::$translationFolderPath);\n $translator = new Translator($loader, self::$lang);\n self::$engine = new Factory($translator, new Container());\n }\n\n return self::$engine;\n }", "public static function new(): static\n {\n $data = API::ffi()->ts_parser_new();\n\n return new static(API::ffi(), $data);\n }", "public function createFSService();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create() {\n\t \n }", "protected function simulateFrontendEnvironment() {\n\t\t$this->tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL;\n\t\t\t// set the working directory to the site root\n\t\t$this->workingDirectoryBackup = getcwd();\n\t\tchdir(PATH_site);\n\n\t\t$typoScriptSetup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);\n\t\t$GLOBALS['TSFE'] = new stdClass();\n\t\t$template = t3lib_div::makeInstance('t3lib_TStemplate');\n\t\t$template->tt_track = 0;\n\t\t$template->init();\n\t\t$template->getFileName_backPath = PATH_site;\n\t\t$GLOBALS['TSFE']->tmpl = $template;\n\t\t$GLOBALS['TSFE']->tmpl->setup = $typoScriptSetup;\n\t\t$GLOBALS['TSFE']->config = $typoScriptSetup;\n\t}", "protected function makeSimulatedTsfe(int $pid, array $storage): TypoScriptFrontendController\n {\n $key = md5(SerializerUtil::serialize($storage['languageAspect']) . '_' . $pid);\n if (isset($this->instanceCache[$key])) {\n return $this->instanceCache[$key];\n }\n \n /** @var TypoScriptFrontendController|null $tsfe */\n $tsfe = $GLOBALS['TSFE'];\n \n if ($tsfe instanceof TypoScriptFrontendController) {\n $args = $tsfe->getPageArguments();\n $pageArguments = $this->makeInstance(\n PageArguments::class,\n [\n $pid,\n $args->getPageType(),\n $args->getRouteArguments(),\n $args->getStaticArguments(),\n $args->getDynamicArguments(),\n ]\n );\n } else {\n $pageArguments = $this->makeInstance(PageArguments::class, [$pid, '0', [], [], []]);\n }\n \n $context = $this->getTypoContext();\n $simulateCliRequest = false;\n \n try {\n // In the CLI there is no root request, so the instantiation of the TSFE fails.\n // This hack creates a fallback to allow the script to run with the current site base url\n if ($context->env()->isCli() && $context->request()->getRootRequest() === null) {\n $simulateCliRequest = true;\n $baseUrl = $context->site()->getCurrent()->getBase();\n /** @noinspection HostnameSubstitutionInspection */\n $_SERVER['HTTP_HOST'] = $baseUrl->getHost();\n $_SERVER['REQUEST_URI'] = $baseUrl->getPath() . '?' . $baseUrl->getQuery();\n GeneralUtility::flushInternalRuntimeCaches();\n }\n \n $controller = $this->makeInstance(\n SimulatedTypoScriptFrontendController::class, [\n $context->getRootContext(),\n $context->site()->getCurrent(),\n $context->language()->getCurrentFrontendLanguage(),\n $pageArguments,\n $this->makeInstance(FrontendUserAuthentication::class),\n ]\n );\n \n } finally {\n if ($simulateCliRequest) {\n $GLOBALS['TYPO3_REQUEST'] = null;\n $GLOBALS['TYPO3_REQUEST_FALLBACK'] = null;\n }\n }\n \n \n $GLOBALS['TSFE'] = $controller;\n $controller->sys_page = $this->pageService->getPageRepository();\n $controller->rootLine = $this->pageService->getRootLine($pid);\n $controller->page = $this->pageService->getPageInfo($pid);\n $controller->getConfigArray();\n $controller->settingLanguage();\n $controller->cObj = $this->makeInstance(ContentObjectRenderer::class, [$controller, $this->getContainer()]);\n \n return $this->instanceCache[$key] = $controller;\n }", "abstract function create();", "public static function create() {}", "public static function create() {}", "public static function create() {}", "public function create()\n\t {\n\t //\n\t }" ]
[ "0.6976391", "0.6676943", "0.6447059", "0.636777", "0.6349801", "0.6219838", "0.6138009", "0.58910096", "0.5665983", "0.56044847", "0.5567781", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5494795", "0.5437414", "0.5419826", "0.53909457", "0.5374159", "0.5373209", "0.5373209", "0.5373209", "0.5372698" ]
0.67782396
1
Returns a new instance of TimeTracker
protected function getTimeTrackerInstance() { return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getTimeTracker() {}", "protected function initializeTimeTracker() {}", "public function create(array $values = array()) {\n // Add values that are specific to our timetracking\n $values += array( \n 'timetracking_id' => '',\n 'is_new' => true,\n 'type' => 'timetracking', //allways fixed because we have no bundles \n 'created' => time(),\n 'changed' => time(),\n 'time_start' => 0,\n 'time_end' => 0,\n 'duration' => 0,\n 'description' => '',\n 'subject_id' => 0,\n 'uid' => 0,\n );\n \n $timetracking = parent::create($values);\n return $timetracking;\n }", "public function __construct()\n {\n $this->dateTime = new Time('now', 'Asia/Jakarta', 'id_ID');\n }", "public static function prayerTimeInstance(){\n if(isset(self::$prayerTime)){\n return self::$prayerTime;\n } else{\n return self::$prayerTime = new PrayTime();\n }\n }", "private static function setTimeTracker()\n {\n if (!is_object($GLOBALS['TT'])) {\n $GLOBALS['TT'] = Tx_Smarty_Service_Compatibility::makeInstance('t3lib_TimeTrackNull');\n }\n }", "function timetracking_create($values = array()) {\n return entity_get_controller('timetracking')->create($values);\n}", "public function __construct()\n {\n $this->local_time = time();\n }", "public function __construct() {\n $this->time = time();\n }", "public static function create(...$args): Time\n {\n return new Time(...$args);\n }", "private function __construct()\n {\n $this->time = time();\n }", "public static function now(): self\n {\n return new static(new DateTime());\n }", "private function getTours()\n {\n $this->tours = Tour::get();\n return $this;\n }", "public static function createInstance()\n {\n return new TimeField('ISerializable', 'ISerializable');\n }", "public static function get(): Timer\n {\n return new self();\n }", "function __construct(){\r\n $this->timestamp = time();\r\n }", "public function select(){\n return new Tracker;\n }", "public static function new(): static\n {\n $data = API::ffi()->ts_parser_new();\n\n return new static(API::ffi(), $data);\n }", "public function getTracker()\n\t{\n\t\tif($this->_tracker === null)\n\t\t{\n\t\t\t$opf = Opl_Registry::get('opf');\n\t\t\t$className = $opf->defaultTracker;\n\t\t\t$tracker = new $className;\n\t\t\tif(!$tracker instanceof Opf_Tracker_Interface)\n\t\t\t{\n\t\t\t\tthrow new Opf_Exception('Invalid object type(' . get_class($tracker) . '), should be Opf_Tracker_Interface');\n\t\t\t}\n\t\t\t$this->_tracker = $tracker;\n\t\t}\n\t\treturn $this->_tracker;\n\t}", "public static function instance() {\n if( is_null( ExpTimeMon::$instance )) ExpTimeMon::$instance =\n new ExpTimeMon (\n EXPTIMEMON_DEFAULT_HOST,\n EXPTIMEMON_DEFAULT_USER,\n EXPTIMEMON_DEFAULT_PASSWORD,\n EXPTIMEMON_DEFAULT_DATABASE );\n return ExpTimeMon::$instance;\n }", "public static function now()\n {\n return new plugin_datetime(date('Y-m-d H:i:s', time()));\n }", "public static function instance() {\n\t\t\tif ( ! isset( self::$instance ) && ! ( self::$instance instanceof AffiliateWP_Direct_Link_Tracking ) ) {\n\n\t\t\t\tself::$instance = new AffiliateWP_Direct_Link_Tracking;\n\t\t\t\tself::$version = '1.1.4';\n\n\t\t\t\tself::$instance->setup_constants();\n\t\t\t\tself::$instance->load_textdomain();\n\t\t\t\tself::$instance->init();\n\t\t\t\tself::$instance->includes();\n\t\t\t\tself::$instance->hooks();\n\n\t\t\t\tself::$instance->tracking = new AffiliateWP_Direct_Link_Tracking_Base;\n\t\t\t\tself::$instance->direct_links = new Affiliate_WP_Direct_Links_DB;\n\t\t\t\tself::$instance->frontend = new AffiliateWP_Direct_Link_Tracking_Frontend;\n\t\t\t\tself::$instance->emails = new AffiliateWP_Direct_Link_Tracking_Emails;\n\t\t\t}\n\n\t\t\treturn self::$instance;\n\t\t}", "function tempus(): TimeConverter\n {\n return new TimeConverter();\n }", "function __construct() {\n parent::__construct();\n \n date_default_timezone_set('Europe/London');\n \n $this->updateTime = date('Y-m-d H:m:s', strtotime('now'));\n \n\n }", "public function __construct()\n\t{\n\t\tparent::__construct();\n\t\t$this->timestamp = time();\n\t}", "protected function cloneToMutable() : Time\n {\n return clone $this;\n }", "public function getTracker()\n {\n return $this->tracker;\n }", "protected function saveTracking()\n {\n if (!$this->recorded) {\n return $this;\n }\n\n $data = [\n [\n 'time' => (new \\DateTime())->format(\\DateTime::ISO8601),\n 'data' => $this->recorded,\n ]\n ];\n\n // grab existing tracking\n $existing = $this->storage->load(\"{$this->new->id}_tracking\", []);\n $existing = array_merge($existing, $data);\n\n // save\n $this->storage->save(\"{$this->new->id}_tracking\", $existing);\n return $this;\n }", "public static function instance() {\n\t\treturn new self;\n\t}", "public function __construct()\n\t{\n\t\t$this->setTimeStamp();\n\t}" ]
[ "0.6842531", "0.67228603", "0.63513404", "0.6069141", "0.60221213", "0.6018472", "0.6001118", "0.5845434", "0.5842843", "0.58261526", "0.57741", "0.5714983", "0.5706969", "0.56792456", "0.5652791", "0.5652356", "0.55930454", "0.5590635", "0.55813164", "0.55407757", "0.55144453", "0.5470914", "0.54455584", "0.53993", "0.53946257", "0.5375623", "0.5338591", "0.52940655", "0.5254193", "0.5231016" ]
0.8074251
0
Returns an object manager mock that is capable of returning one or more documents for find(). $documents should be an associative array of searchString => document (mock object)
protected function getObjectManager(array $documents) { $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); $objectManager ->expects($this->any()) ->method('find') ->will( $this->returnCallback( function ($class, $searchString) use ($documents) { return $documents[$searchString]; } ) ); return $objectManager; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createMongoDBMock()\n {\n return m::mock(\\MongoDB\\Database::class);\n }", "abstract public function getDocuments();", "public function getDocuments();", "public function get_documents()\n {\n $this->validate_query_key();\n\n $objDocuments = $this\n ->set_per_page()\n ->set_page()\n ->set_facets()\n ->set_filter()\n ->set_exclude_filter()\n ->set_sorting()\n ->set_spellcheck()\n ->set_highlights()\n ->set_result_fields()\n ->get();\n\n $objDocuments->matches = $this->parse_documents($objDocuments->matches);\n return $objDocuments;\n }", "public function testListDocuments()\n {\n }", "public function testChainedFinders()\n {\n $index = new Index();\n $query = new Query($index);\n\n $finder = $query->find()->find();\n $this->assertInstanceOf(\\Cake\\ElasticSearch\\Query::class, $finder);\n }", "public function find(array $options = array())\n {\n // query\n if (!isset($options['query'])) {\n $options['query'] = array();\n }\n\n // fields\n if (!isset($options['fields'])) {\n $options['fields'] = array();\n }\n\n // cursor\n $cursor = $this->getCollection()->find($options['query'], $options['fields']);\n\n // sort\n if (isset($options['sort'])) {\n $cursor->sort($options['sort']);\n }\n\n // one\n if (isset($options['one'])) {\n $cursor->limit(1);\n // limit\n } elseif (isset($options['limit'])) {\n $cursor->limit($options['limit']);\n }\n\n // skip\n if (isset($options['skip'])) {\n $cursor->skip($options['skip']);\n }\n\n // results\n $results = array();\n foreach ($cursor as $data) {\n $results[] = $document = new $this->documentClass();\n if ($this->isFile) {\n $file = $data;\n $data = $file->file;\n $data['file'] = $file;\n }\n $document->setDocumentData($data);\n }\n\n if ($results) {\n // one\n if (isset($options['one'])) {\n return array_shift($results);\n }\n\n return $results;\n }\n\n return null;\n }", "function findDocuments( $orderby='name DESC' )\n\t{\n\t\t//return MyActiveRecord::FindAll( 'Documents', 'item_id = '.$this->id, $orderby );\n\t\treturn MyActiveRecord::FindBySql('Documents', \"SELECT * FROM documents WHERE item_id = \".$this->id.\" ORDER BY \".$orderby.\"\");\n\t}", "protected function createMongoCollectionMock()\n {\n return m::mock(\\MongoDB\\Collection::class);\n }", "protected function getDoctrine()\n {\n $config = $this->getMockAnnotatedConfig();\n $dm = \\Doctrine\\ODM\\MongoDB\\DocumentManager::create(null, $config);\n\n return $this->doctrine = m::mock(array(\n 'getManager' => $dm,\n 'getManagers' => array($dm),\n 'getManagerForClass' => $dm\n ));\n\n // $conn = array(\n // 'driver' => 'pdo_sqlite',\n // 'memory' => true,\n // // 'path' => __DIR__.'/../db.sqlite',\n // );\n\n // $config = $this->getMockAnnotatedConfig();\n // $em = EntityManager::create($conn, $config);\n\n // $entities = array(\n // 'Khepin\\\\Fixture\\\\Entity\\\\Car',\n // 'Khepin\\\\Fixture\\\\Entity\\\\Driver'\n // );\n\n // $schema = array_map(function($class) use ($em) {\n // return $em->getClassMetadata($class);\n // }, $entities);\n\n // $schemaTool = new SchemaTool($em);\n // $schemaTool->dropSchema(array());\n // $schemaTool->createSchema($schema);\n // return $this->doctrine = m::mock(array(\n // 'getEntityManager' => $em,\n // 'getManager' => $em,\n // )\n // );\n }", "public static function connect() {\n\t\t$connection = new Connection(MONGO_DB_HOST);\n\t\t$config = new Configuration();\n\t\t$config->setProxyDir('../cache/mongo/proxies');\n\t\t$config->setProxyNamespace('MongoProxies');\n\t\t$config->setHydratorDir('../cache/mongo/hydrators');\n\t\t$config->setHydratorNamespace('MongoHydrators');\n\t\t$config->setDefaultDB(MONGO_DB_NAME);\n\t\t$config->setMetadataDriverImpl(AnnotationDriver::create('../app/models/MongoDocs'));\n\t\tAnnotationDriver::registerAnnotationClasses();\n\t\treturn DocumentManager::create($connection, $config);\n\t}", "public function documents()\n {\n return $this->hasMany(DocumentManager::class, 'doc_project_id');\n }", "function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())\n\t{\n\t\t\t\n\t\tif(is_array($document_srls))\n\t\t{\n\t\t\t$list_count = count($document_srls);\n\t\t\t$document_srls = implode(',',$document_srls);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$list_count = 1;\n\t\t}\n\t\t$args = new stdClass();\n\t\t$args->document_srls = $document_srls;\n\t\t$args->list_count = $list_count;\n\t\t$args->order_type = 'asc';\n\n\t\t$output = executeQuery('document.getDocuments', $args, $columnList);\n\t\t$document_list = $output->data;\n\t\tif(!$document_list) return;\n\t\tif(!is_array($document_list)) $document_list = array($document_list);\n\n\t\t$document_count = count($document_list);\n\t\tforeach($document_list as $key => $attribute)\n\t\t{\n\t\t\t$document_srl = $attribute->document_srl;\n\t\t\tif(!$document_srl) continue;\n\n\t\t\tif(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])\n\t\t\t{\n\t\t\t\t$oDocument = null;\n\t\t\t\t$oDocument = new documentItem();\n\t\t\t\t$oDocument->setAttribute($attribute, false);\n\t\t\t\tif($is_admin) $oDocument->setGrant();\n\t\t\t\t$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;\n\t\t\t}\n\n\t\t\t$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];\n\t\t}\n\n\t\tif($load_extra_vars) $this->setToAllDocumentExtraVars();\n\n\t\t$output = null;\n\t\tif(count($result))\n\t\t{\n\t\t\tforeach($result as $document_srl => $val)\n\t\t\t{\n\t\t\t\t$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];\n\t\t\t}\n\t\t}\n\n\t\treturn $output;\n\t}", "public function testListAllDocuments()\n {\n }", "public function setDocuments($documents) {\n $this->_documents = $documents;\n }", "public function getDocumentManager()\n {\n return $this->getObjectManager();\n }", "private function fetchDocumentsMetadata()\n {\n $this->metadata = [];\n $documentClasses = [];\n\n foreach ($this->indexManagers as $indexManagerName => $indexSettings) {\n $indexAnalyzers = isset($indexSettings['settings']['analysis']['analyzer']) ? $indexSettings['settings']['analysis']['analyzer'] : [];\n\n // Fetches DocumentMetadata objects for the types within the index\n foreach ($indexSettings['types'] as $documentClass) {\n if (isset($documentClasses[$documentClass])) {\n throw new \\InvalidArgumentException(\n sprintf('You cannot have type %s under \"%s\" index manager, as it is already managed by \"%s\" index manager',\n $documentClass, $indexManagerName, $documentClasses[$documentClass]\n )\n );\n }\n $documentClasses[$documentClass] = $indexManagerName;\n $metadata = $this->fetchMetadataFromClass($documentClass, $indexAnalyzers);\n $this->metadata[$indexManagerName][$documentClass] = new DocumentMetadata($metadata);\n }\n }\n\n $this->cache->save(self::CACHE_KEY, $this->metadata);\n if ($this->debug) {\n $this->cache->save('[C]'.self::CACHE_KEY, time());\n }\n\n return $this->metadata;\n }", "public function get_documents() \n {\n $endpoint_name = \"/documents/\";\n $request_arguments = [];\n $documents = $this->request(\"GET\", $endpoint_name, $request_arguments);\n if (array_key_exists(\"documents\", $documents)) {\n return $documents[\"documents\"];\n }\n return $documents;\n }", "public function find(array $criteria);", "function afterFind($results, $primary = false) {\r\n\t\t// Fast fail if no document on a direct request\r\n\t\tif (empty($primary) && isset($results['id']) && empty($results['id'])) return null;\r\n\t\t// Fast fail if no Document nor Metadatas\r\n\t\tif (!Set::matches('/Metadata', $results)) return $results;\r\n\r\n\t\t// Results are presented in either of two ways :\r\n\t\t// $primary : \tIn a numeric-indexed array where each key contains a Document, Metadata and possible Version key\r\n\t\t//\t\t\t\tThis array will have only one key for a find('first')\r\n\t\t// !primary:\ta/ In a document array (id, parent_id, path, etc) and a Metadata and possible Version subarrays. For belongsTo\r\n\t\t//\t\t\t\tb/ In a numeric-indexed array of a/ arrays, for HABTM\r\n\r\n\r\n\t\t// We guess if we have a list of items or only one item\r\n\r\n\r\n\t\t// Direct request on Document\r\n\t\tif (!empty($primary)) {\r\n\t\t\t// Copying metadatas back into main model\r\n\t\t\tforeach($results as $i => &$item) {\r\n\t\t\t\t// Merging metadatas\r\n\t\t\t\t$this->__mergeMetadata($item['Metadata'], $item[$this->alias]);\r\n\t\t\t\tunset($item['Metadata']);\r\n\t\t\t\t// Merging version metadatas\r\n\t\t\t\tif (!empty($item['Version'])) {\r\n\t\t\t\t\tforeach($item['Version'] as &$version) {\r\n\t\t\t\t\t\tif (empty($version['Metadata'])) continue;\r\n\t\t\t\t\t\t$this->__mergeMetadata($version['Metadata'], $version);\r\n\t\t\t\t\t\tunset($version['Metadata']);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Multiples results\r\n\t\t\tif (!empty($results[0])) {\r\n\t\t\t\tforeach($results as $i => &$item) {\r\n\t\t\t\t\t// Merging metadatas\r\n\t\t\t\t\t$this->__mergeMetadata($item['Metadata'], $item);\r\n\t\t\t\t\tunset($item['Metadata']);\r\n\t\t\t\t\t// Merging version metadatas\r\n\t\t\t\t\tif (!empty($item['Version'])) {\r\n\t\t\t\t\t\tforeach($item['Version'] as &$version) {\r\n\t\t\t\t\t\t\tif (empty($version['Metadata'])) continue;\r\n\t\t\t\t\t\t\t$this->__mergeMetadata($version['Metadata'], $version);\r\n\t\t\t\t\t\t\tunset($version['Metadata']);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// To be more readable, we will move the Version key to the end of the array\r\n\t\t\t\t\t\t$_Version = $item['Version'];\r\n\t\t\t\t\t\tunset($item['Version']);\r\n\t\t\t\t\t\t$item['Version'] = $_Version;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t// Merging metadatas\r\n\t\t\t\t$this->__mergeMetadata($results['Metadata'], $results);\r\n\t\t\t\tunset($results['Metadata']);\r\n\t\t\t\t// Merging version metadatas\r\n\t\t\t\tif (!empty($results['Version'])) {\r\n\t\t\t\t\tforeach($results['Version'] as &$version) {\r\n\t\t\t\t\t\tif (empty($version['Metadata'])) continue;\r\n\t\t\t\t\t\t$this->__mergeMetadata($version['Metadata'], $version);\r\n\t\t\t\t\t\tunset($version['Metadata']);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// To be more readable, we will move the Version key to the end of the array\r\n\t\t\t\t\t$_Version = $results['Version'];\r\n\t\t\t\t\tunset($results['Version']);\r\n\t\t\t\t\t$results['Version'] = $_Version;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $results;\r\n\t}", "public function getDocuments() {\n\t\t$user = $this->auth->user();\n\n\t\tif(!$user) {\n\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\"code\" => 401,\n\t\t\t\t\"message\" => \"Permisos denegados para el cliente\",\n\t\t\t\t\"response\" => null\n\t\t\t]);\n\t\t} else {\n\t\t\t$documents = Documents::where('id_user', $user->id)->where('status', '1')->get(['id', 'folio', 'location', 'type', 'alias', 'notes', 'subtype', 'picture_path', 'expedition', 'expiration', 'created_at']);\n\n\t\t\tif($documents->count()) {\n\t\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\t\"code\" => 200,\n\t\t\t\t\t\"message\" => \"Listado de documentos\",\n\t\t\t\t\t\"response\" => array(\"documents\" => $documents)\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\treturn CustomResponsesHandler::response([\n\t\t\t\t\t\"code\" => 202,\n\t\t\t\t\t\"message\" => \"No se encontraron documentos\",\n\t\t\t\t\t\"response\" => null\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}", "public function testConstructorWithResult()\n {\n $data = ['foo' => 1, 'bar' => 2];\n $result = new BSONDocument($data);\n $document = new Document($result);\n $this->assertSame($data, $document->toArray());\n }", "public function documents(): EstatesDocuments\n {\n if (is_null($this->documentsEndpoint)) {\n $this->documentsEndpoint = new EstatesDocuments($this->api);\n }\n return $this->documentsEndpoint;\n }", "private function getDAO()\n {\n return $this->get('doctrine_mongodb')->getManager()\n ->getRepository('ResumeBundle:ResumeDocument');\n }", "public function find(array $conditions = []);", "public function createInstance()\n {\n $mock = $this->mock('Dhii\\\\SimpleTest\\\\Locator\\\\ResultSetInterface')\n ->getTests()\n ->new();\n\n return $mock;\n }", "public function getDocuments()\n {\n return $this->parseResult();\n }", "public function testSearchDocument()\n {\n echo \"\\nTesting document search...\";\n //$url = TestServiceAsReadOnly::$elasticsearchHost . \"/CIL_RS/index.php/rest/documents?search=mouse\";\n $url = TestServiceAsReadOnly::$elasticsearchHost . $this->context.\"/documents?search=mouse\";\n \n $response = $this->curl_get($url);\n //echo \"\\n-------Response:\".$response;\n $result = json_decode($response);\n $total = $result->hits->total;\n \n $this->assertTrue(($total > 0));\n }", "public function get_document($record, $options = array()) {\n\n try {\n $cm = $this->get_cm($this->get_module_name(), $record->id, $record->course);\n $context = \\context_module::instance($cm->id);\n } catch (\\dml_missing_record_exception $ex) {\n // Notify it as we run here as admin, we should see everything.\n debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document, not all required data is available: ' .\n $ex->getMessage(), DEBUG_DEVELOPER);\n return false;\n } catch (\\dml_exception $ex) {\n // Notify it as we run here as admin, we should see everything.\n debugging('Error retrieving ' . $this->areaid . ' ' . $record->id . ' document: ' . $ex->getMessage(), DEBUG_DEVELOPER);\n return false;\n }\n\n // Prepare associative array with data from DB.\n $doc = \\core_search\\document_factory::instance($record->id, $this->componentname, $this->areaname);\n $doc->set('title', content_to_text($record->name, false));\n $doc->set('content', content_to_text($record->intro, $record->introformat));\n $doc->set('contextid', $context->id);\n $doc->set('courseid', $record->course);\n $doc->set('owneruserid', \\core_search\\manager::NO_OWNER_ID);\n $doc->set('modified', $record->{static::MODIFIED_FIELD_NAME});\n\n // Check if this document should be considered new.\n if (isset($options['lastindexedtime'])) {\n $createdfield = static::CREATED_FIELD_NAME;\n if (!empty($createdfield) && ($options['lastindexedtime'] < $record->{$createdfield})) {\n // If the document was created after the last index time, it must be new.\n $doc->set_is_new(true);\n }\n }\n\n return $doc;\n }", "public function find($documentClass, array $options = array())\n {\n return $this->getRepository($documentClass)->find($options);\n }" ]
[ "0.59144634", "0.5902094", "0.5843777", "0.57373106", "0.5725653", "0.555542", "0.5534641", "0.5527029", "0.5469903", "0.54365957", "0.5423823", "0.5379411", "0.53657925", "0.5352716", "0.5317109", "0.529315", "0.52746946", "0.52632755", "0.52503985", "0.52421135", "0.5240509", "0.5227284", "0.5197713", "0.5179199", "0.51597464", "0.5153559", "0.50812477", "0.506263", "0.50590795", "0.50565326" ]
0.82971185
0
Returns a manager registry mock that is capable of returning one or more object managers for getManager(). $objectManagers should be an associative array of managerName => manager (mock object)
protected function getManagerRegistry(array $objectManagers) { $managerRegistry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); $managerRegistry ->expects($this->any()) ->method('getManager') ->will( $this->returnCallback( function ($name) use ($objectManagers) { return $objectManagers[$name]; } ) ); return $managerRegistry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getObjectManager()\n {\n return $this->managerRegistry->getManager($this->managerName);\n }", "public function getManagers()\n {\n // TODO: Implement getManagers() method.\n }", "public function getObjectManager() {}", "protected function getObjectManager(array $documents)\n {\n $objectManager = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');\n $objectManager\n ->expects($this->any())\n ->method('find')\n ->will(\n $this->returnCallback(\n function ($class, $searchString) use ($documents) {\n return $documents[$searchString];\n }\n )\n );\n\n return $objectManager;\n }", "public function getObjectManager();", "public function getObjectManager();", "public function getObjectManager()\r\n {\r\n return $this->objectManager;\r\n }", "public function getObjectManager() {\n\t\tif(($this->objectManager instanceof \\TYPO3\\CMS\\Extbase\\Object\\ObjectManager) === false) {\n\t\t\t$this->objectManager = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance(\\TYPO3\\CMS\\Extbase\\Object\\ObjectManager::class);\n\t\t}\n\n\t\treturn $this->objectManager;\n\t}", "public function getObjectManager() {\n\t\tif(($this->objectManager instanceof \\TYPO3\\CMS\\Extbase\\Object\\ObjectManager) === false) {\n\t\t\t$this->objectManager = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance('TYPO3\\\\CMS\\\\Extbase\\\\Object\\\\ObjectManager');\n\t\t}\n\n\t\treturn $this->objectManager;\n\t}", "public function getManagers()\n {\n return [$this->entityManager];\n }", "public function getObjectManager(): mixed\n {\n return $this->objectManager;\n }", "public function getObjectManager()\n {\n return $this->objectManager;\n }", "public function getObjectManager()\n {\n return $this->objectManager;\n }", "public function getObjectManager()\n {\n return $this->objectManager;\n }", "public function getObjectManager()\n {\n return $this->objectManager;\n }", "public function getManagers()\n {\n return $this->managers;\n }", "protected function getObjectManager()\n {\n return $this->objectManager;\n }", "protected function getObjectManager() {}", "protected function getObjectManager()\n {\n return $this->_objectManager;\n }", "public static function getManager($a_sManager) {\n $sClassNamePrefix = preg_replace(\"/_([a-z])/e\", 'strtoupper(\"\\\\1\")', $a_sManager);\n $sClassName = $sClassNamePrefix . 'Manager';\n\n if (!array_key_exists($sClassNamePrefix, self::$_aStoredObjects)) {\n $sMapperFactoryName = \"MappingFactory_{$sClassNamePrefix}MappingFactory\";\n self::$_aStoredObjects[$sClassNamePrefix] = new $sClassName(new $sMapperFactoryName());\n }\n\n return self::$_aStoredObjects[$sClassNamePrefix];\n }", "public function setObjectManager(ObjectManager $objectManager);", "private function configureObjectManager()\n {\n $frameworkSetup = $this->configurationManager\n ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);\n if (!is_array($frameworkSetup['objects'])) {\n return;\n }\n $objectContainer = GeneralUtility::makeInstance(Container::class);\n foreach ($frameworkSetup['objects'] as $classNameWithDot => $classConfiguration) {\n if (isset($classConfiguration['className'])) {\n $originalClassName = rtrim($classNameWithDot, '.');\n $objectContainer->registerImplementation($originalClassName, $classConfiguration['className']);\n }\n }\n }", "protected function injectObjectManager(\n $resolver,\n array $validClassNames = [],\n array $invalidClassNames = []\n )\n {\n $reflectionService = $this->createMock(ReflectionService::class);\n $objectManager = $this->createMock(ObjectManagerInterface::class);\n $returnMap = [];\n\n $returnMap[] = [ReflectionService::class, $reflectionService];\n\n if (is_a(current($validClassNames), static::RESOLVER_TARGET_CLASS)) {\n $reflectionService->method('getAllImplementationClassNamesForInterface')\n ->with(static::RESOLVER_TARGET_CLASS)->willReturn(array_keys($validClassNames));\n } else {\n $reflectionService->method('getAllImplementationClassNamesForInterface')\n ->with(static::RESOLVER_TARGET_CLASS)->willReturn($validClassNames);\n }\n\n foreach ($validClassNames as $key => $value) {\n if (is_a($value, static::RESOLVER_TARGET_CLASS)) {\n $instance = $value;\n $validClassName = $key;\n } else {\n $instance = $this->getMockBuilder(static::RESOLVER_TARGET_CLASS)\n ->setMethods(array_merge(\n ['getClassNameForTestPurposes'],\n get_class_methods(static::RESOLVER_TARGET_CLASS)\n ))\n ->getMock();\n $instance->method('getClassNameForTestPurposes')->willReturn($value);\n\n $validClassName = $value;\n }\n\n $returnMap[] = [$validClassName, $instance];\n }\n\n foreach ($invalidClassNames as $invalidClassName) {\n $returnMap[] = [$invalidClassName, new \\stdClass];\n }\n\n $objectManager->method('isRegistered')->will($this->returnCallback(\n function ($name) use ($validClassNames, $invalidClassNames) {\n return in_array($name, $validClassNames) || array_key_exists($name, $validClassNames) ||\n in_array($name, $invalidClassNames);\n }\n ));\n $objectManager->method('get')->will($this->returnValueMap($returnMap));\n\n $this->inject($resolver, 'objectManager', $objectManager);\n }", "public function setManagers($managers)\n {\n $this->managers = $managers;\n }", "public static function getRealServiceManager()\n {\n // When we fix our unit tests to mock all dependencies\n // we need to put this line back in to speed up our tests\n //return m::mock('\\Laminas\\ServiceManager\\ServiceManager')->makePartial();\n\n $serviceManager = new ServiceManager(new ServiceManagerConfig());\n $serviceManager->setService('ApplicationConfig', self::$config);\n $serviceManager->get('ModuleManager')->loadModules();\n $serviceManager->setAllowOverride(true);\n\n $config = $serviceManager->get('Config');\n $config['service_api_mapping']['endpoints']['backend'] = 'http://some-fake-backend/';\n $serviceManager->setService('Config', $config);\n\n $translator = m::mock(\\Laminas\\I18n\\Translator\\Translator::class)->makePartial();\n /** @var Translator $mvcTranslator */\n $mvcTranslator = m::mock(Translator::class, [$translator])->makePartial();\n $serviceManager->setService('MvcTranslator', $mvcTranslator);\n\n /*\n * NP 17th Nov 2014\n *\n * Although this is commented out I'd like to leave it in for now;\n * it's a more elegant way to trap unmocked backend requests than\n * setting a fake URL as above. Only trouble is at the moment $path\n * always comes through as null... needs a bit of investigation\n *\n $closure = function ($method, $path, $params) {\n $str = sprintf(\n \"Trapped unmocked backend request: %s %s\",\n $method, $path\n );\n throw new \\Exception($str);\n };\n\n $serviceManager->setService(\n 'ServiceApiResolver',\n m::mock()\n ->shouldReceive('getClient')\n ->andReturn(\n m::mock('\\Common\\Util\\RestClient[request]', [new \\Laminas\\Uri\\Http])\n ->shouldReceive('request')\n ->andReturnUsing($closure)\n ->getMock()\n )\n ->getMock()\n );\n */\n\n return $serviceManager;\n }", "public function getRepositoryManagers()\n {\n return $this->repositoryManagers;\n }", "public function getManager($name = null)\n {\n // TODO: Implement getManager() method.\n }", "public function getMockers()\n {\n $validator = $this->getMockBuilder('Symfony\\Component\\Validator\\Validator\\ValidatorInterface')\n ->disableOriginalConstructor()->getMock();\n\n return $mockers = [\n 'validator' => $validator\n ];\n }", "public function setObjectManager($objectManager)\n {\n $this->objectManager = $objectManager;\n }", "protected function getMocks()\n {\n $projects = [];\n $recordings = [];\n $brands = [];\n\n $brandId = 1;\n $userId = 1;\n for ($i = 1; $i <= 5; $i++) {\n $recordings[] = Mockery::mock('Tornado\\Project\\Recorings', [\n 'getPrimaryKey' => $i,\n 'getBrandId' => $brandId,\n 'toArray' => ['id' => $i]\n ]);\n }\n for ($i = 1; $i <= 5; $i++) {\n $projects[] = Mockery::mock('Tornado\\Project\\Project', [\n 'getPrimaryKey' => $i,\n 'getBrandId' => $brandId,\n 'toArray' => ['id' => $i]\n ]);\n }\n for ($i = 1; $i <= 5; $i++) {\n $brands[] = Mockery::mock('Tornado\\Organization\\Brand', [\n 'getId' => $i,\n 'getPrimaryKey' => $i,\n 'toArray' => ['id' => $i]\n ]);\n }\n $brands[0]->projects = $projects;\n $brands[0]->recordings = $recordings;\n\n $user = Mockery::mock('\\Tornado\\Organization\\User', [\n 'getId' => $userId\n ]);\n\n $session = Mockery::mock('\\Symfony\\Component\\HttpFoundation\\Session\\SessionInterface');\n $accessDecisionManager = Mockery::mock('\\Tornado\\Security\\Authorization\\AccessDecisionManagerInterface');\n $brandRepo = Mockery::mock('Tornado\\Organization\\Brand\\DataMapper');\n $projectRepo = Mockery::mock('Tornado\\Project\\Project\\DataMapper');\n $recordingRepo = Mockery::mock('Tornado\\Project\\Recording\\DataMapper');\n $request = Mockery::mock('\\DataSift\\Http\\Request');\n $dataSiftRecording = Mockery::mock('\\Tornado\\Project\\Recording\\DataSiftRecording');\n $pylon = Mockery::mock('\\DataSift\\Pylon\\Pylon');\n $urlGenerator = Mockery::mock('\\Symfony\\Component\\Routing\\Generator\\UrlGenerator');\n return [\n 'brandId' => $brandId,\n 'projects' => $projects,\n 'recordings' => $recordings,\n 'brands' => $brands,\n 'userId' => $userId,\n 'user' => $user,\n 'session' => $session,\n 'accessDecisionManager' => $accessDecisionManager,\n 'brandRepository' => $brandRepo,\n 'projectRepository' => $projectRepo,\n 'recordingRepository' => $recordingRepo,\n 'request' => $request,\n 'datasiftRecording' => $dataSiftRecording,\n 'pylon' => $pylon,\n 'url_generator' => $urlGenerator\n ];\n }" ]
[ "0.6343053", "0.6185559", "0.60922706", "0.60772777", "0.6070378", "0.6070378", "0.5949157", "0.5914144", "0.59079576", "0.59040743", "0.5897192", "0.588894", "0.588894", "0.588894", "0.588894", "0.5882814", "0.5822005", "0.5812113", "0.5764868", "0.57554394", "0.57025963", "0.5653493", "0.56107545", "0.5582927", "0.5445462", "0.54343444", "0.54278576", "0.5410463", "0.5308187", "0.53079754" ]
0.86300325
0
Set the calendar title Add the title string to the calendar (if any)
private function makeCalendarTitle() { if(strlen($this->headerTitle) > 0) { $this->calWeekDays .= "\t<tr>\n\t\t<th class=\"headerTitle\" colspan=\"7\">".$this->headerTitle."</th>\n\t</tr>"; $this->outArray['title'] = $this->headerTitle; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function setTitle()\n {\n $this->title = $this->start_date;\n\n if ($this->start_date != $this->end_date) {\n $this->title .= ' - '.$this->end_date;\n }\n }", "protected function setTitle()\n\t{\n\t\tglobal $APPLICATION;\n\n\t\tif ($this->arParams[\"SET_TITLE\"] == 'Y')\n\t\t\t$APPLICATION->SetTitle(Localization\\Loc::getMessage(\"SPOL_DEFAULT_TITLE\"));\n\t}", "function setTitle($title) {\r\n $this->_title = $title;\r\n }", "function setTitle($title) {\r\n $this->_title = $title;\r\n }", "function setTitle($title) {\n\t\t$this->_title = $title;\n\t}", "public function setTitle($title) {\r\n $this->_title = $title;\r\n }", "public function setTitle($title)\r\n\t\t{\r\n\t\t\t$this->_title = $title;\r\n\t\t}", "function set_title($title){\r\n\t\t$this->_title = $title;\r\n\t}", "public function setTitle($title) {\n $this->_title = $title;\n }", "function setTitle($title)\n {\n $this->m_title = $title;\n }", "public function setTitle($title) {\n\t\t\n\t\t\t$this->_title = $title;\n\t\t\n\t\t}", "public function setTitle($title) {\n $this->_title = $title;\n }", "public function setTitle($title)\n {\n $this->_title = $title;\n }", "public function setTitle($title)\n {\n $this->_title = $title;\n }", "public function setTitle($title = '')\n {\n $this->title = $title;\n }", "function setTitle($title) {\n\t\t$this->title = $title;\n\t}", "function setTitle($title)\r\n {\r\n $this->title = $title;\r\n }", "public function setTitle($title) {\r\n $this->title = $title;\r\n }", "public function setTitle($title) {\n\t\t$this->title = $title;\n\t}", "public function setTitle($title) {\n\t\t$this->title = $title;\n\t}", "public function setTitle($title) {\n\t\t$this->title = $title;\n\t}", "public function setTitle($newTitle) { $this->Title = $newTitle; }", "public function setTitle($title){\n $this->title = $title;\n }", "public function setTitle($title)\r\n {\r\n $this->title = $title;\r\n }", "function setTitle($title)\r\n\t{\r\n\t\t$this->title = $title;\r\n\t}", "public function setTitle($title){\n $this->title = $title;\n }", "public function setTitle($title) {\n $this->title = $title ;\n }", "function set_title($title) \r\n\t{\r\n\t\t//$this->title = $title;\r\n\t\t$this->data['title_for_layout'] = $title;\r\n\t\t$this;\r\n\t}", "public function setTitle($title)\n\t{\n\t\t$this->title = $title;\n\t}", "public function setTitle($title)\n\t{\n\t\t$this->title = $title;\n\t}" ]
[ "0.7708907", "0.71849394", "0.7106481", "0.7106481", "0.70784795", "0.70748097", "0.7068428", "0.70663095", "0.7042291", "0.70176363", "0.700437", "0.7003127", "0.69973695", "0.69973695", "0.69933873", "0.6986058", "0.6975316", "0.6974538", "0.6966417", "0.6966417", "0.6966417", "0.6954366", "0.6953463", "0.6951853", "0.69383544", "0.69372195", "0.6936148", "0.6931444", "0.6916839", "0.6916839" ]
0.7574304
1
Set the calendar heading Add the heading string to the calendar.
private function makeCalendarHead() { if(strlen($this->headerStr) < 1) { $head = "\t<tr>\n\t\t<th colspan=\"7\" class=\"headerString\">"; if(!is_null($this->curDay)) { $head .= $this->curDayName.' the '.$this->curDayS.' of '.$this->curMonthName.', '.$this->curYear; } else { $head .= $this->curMonthName.', '.$this->curYear; } $head .= "</th>\n\t</tr>\n"; } else { $head = $this->headerStr; } $this->calWeekDays .= $head; $this->outArray['head'] = $head; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setHeading($h)\n\t{\n\t\t$this->_headingText=$h;\n\t}", "private function makeCalendarTitle()\n\t{\n\t\tif(strlen($this->headerTitle) > 0) {\n\t\t\t$this->calWeekDays .= \"\\t<tr>\\n\\t\\t<th class=\\\"headerTitle\\\" colspan=\\\"7\\\">\".$this->headerTitle.\"</th>\\n\\t</tr>\";\n\t\t\t$this->outArray['title'] = $this->headerTitle;\n\t\t}\n\t}", "function set_heading()\n\t{\n\t\t$args = func_get_args();\n\t\t$this->heading = $this->_prep_args($args);\n\t}", "public function set_heading($heading) {\n $this->heading=$heading;\n if (!isset($this->form_name) or $this->form_name=='') {\n $this->form_name=$heading;\n error_log(\"BasicForm: Had to revert form name to form heading\");\n }\n }", "private function generateHeading()\n {\n //get current dimensions\n\t\t$highestRow = $this->objWorksheet->getHighestRow(); // e.g. 10\n\t\t$highestColumn = $this->objWorksheet->getHighestColumn(); // e.g 'F'\n\n\t\t$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);\n\n\t\t//insert row on top\n\t\t$this->objWorksheet->insertNewRowBefore(1,2);\n\n\t\t//merge cells\n\t\t$this->objWorksheet->mergeCells(\"A1:\".$highestColumn.\"1\");\n\n\t\t//set the text for header\n\t\t$this->objWorksheet->setCellValue(\"A1\", $this->_headingText);\n\t\t$this->objWorksheet->getStyle('A1')->getAlignment()->setWrapText(true);\n\t\t$this->objWorksheet->getRowDimension('1')->setRowHeight(48);\n\n //Apply style\n\t\t$this->objWorksheet->getStyle(\"A1\")->applyFromArray($this->_headingStyleArray);\n }", "private function setTitle()\n {\n $this->title = $this->start_date;\n\n if ($this->start_date != $this->end_date) {\n $this->title .= ' - '.$this->end_date;\n }\n }", "function addHeading(& $heading, & $parentElement) {\n\t\t$headingElement =& $this->_document->createElement('heading');\n\t\t$parentElement->appendChild($headingElement);\n\t\t\n\t\t$this->addCommonProporties($heading, $headingElement);\n\t\t\n\t\tif ($heading->getField('location') == 'right')\n\t\t\t$headingElement->setAttribute('location', 'right');\n\t\telse\n\t\t\t$headingElement->setAttribute('location', 'left');\n\t}", "public function heading(string $heading): CustomTextCard\n {\n return $this->setMeta('heading', $heading);\n }", "private function renderContentHeading() {\n\t\t$this->setMarker('content_id', $this->getContentUid());\n\t\t$this->setMarker(\n\t\t\t'content_heading',\n\t\t\thtmlspecialchars($this->cObj->data['subheader'])\n\t\t);\n\t}", "function new_heading()\n {\n }", "function setHeaderText($value) {\n $this->header_text = $value;\n}", "function setHeaderTitle($value) {\n $this->header_title = $value;\n}", "public function setHeading($var)\n {\n GPBUtil::checkDouble($var);\n $this->heading = $var;\n\n return $this;\n }", "function setHeader($string)\n {\n if (!empty($this->header))\n {\n $this->header .= $string;\n }\n else \n {\n $this->header = $string;\n }\n }", "public function setTitle($str)\n\t{\n\t\t$this->headerTitle = $str;\n\t}", "public static function setHTMLHeader($header) \n\t{\n\t\tacPhpCas::setReporting();\n\t\tphpCAS::setHTMLHeader($header);\t\t\n\t}", "private function makeDayHeadings()\n\t{\n\t\t$this->outArray['dayheadings'] = array();\n\t\t$this->dayHeadings .= \"\\t<tr>\\n\";\n\t\tforeach($this->daysArray as $day) {\n\t\t\t$this->dayHeadings .= \"\\t\\t<th class=\\\"dayHeading\\\">$day</th>\\n\";\n\t\t\tarray_push($this->outArray['dayheadings'], $day);\n\t\t}\n\t\t$this->dayHeadings .= \"\\t</tr>\\n\";\n\t\t\n\t\t$this->calWeekDays .= $this->dayHeadings;\n\t}", "function Header() {\n if(empty($this->title) || $this->PageNo() == 1) return;\n $oldColor = $this->TextColor;\n $this->SetTextColor(PDF_HEADER_COLOR['red'],\n PDF_HEADER_COLOR['green'],\n PDF_HEADER_COLOR['blue']);\n $x = $this->GetX();\n $y = $this->GetY();\n $this->SetY(10, false);\n $this->SetFont('', 'B');\n $this->Cell(0, 10, $this->title);\n $this->SetFont('', '');\n $this->SetXY($x, $y);\n $this->TextColor = $oldColor;\n }", "public function setHeader($header)\n {\n $this->_header = $header;\n }", "public function setHeading($heading)\n {\n $this->heading = $heading;\n return $this;\n }", "function renderHeader(&$header)\n {\n if ($name = $header->getName()) {\n $this->_ary['header'][$name] = $header->toHtml();\n } else {\n $this->_ary['header'][$this->_sectionCount] = $header->toHtml();\n }\n $this->_currentSection = $this->_sectionCount++;\n }", "public function SetHeadTitle ($title) {\r\n\t\t$this->head->SetTitle($title);\r\n\t}", "public function setHeader($header);", "protected function setHeaderWithSportAndYear() {\n\t\t$HeaderParts = array();\n\n\t\tif ($this->sportid > 0 && $this->ShowSportsNavigation) {\n\t\t\t$Sport = new Sport($this->sportid);\n\t\t\t$HeaderParts[] = $Sport->name();\n\t\t}\n\n\t\tif ($this->ShowYearsNavigation) {\n\t\t\t$HeaderParts[] = $this->getYearString();\n\t\t}\n\n\t\tif (!empty($HeaderParts)) {\n\t\t\t$this->setHeader($this->name().': '.implode(', ', $HeaderParts));\n\t\t}\n\t}", "public function addHeader($header);", "private function headings() {\n\t\t$this->section_data['general_h_tags'] = array(\n\t\t\t'name' \t\t\t\t\t=> 'general_h_tags',\n\t\t\t'label' \t\t\t\t=> __( 'Headings', 'fixedtoc' ),\n\t\t\t'default' \t\t\t=> array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ),\n\t\t\t'type' \t\t\t\t\t=> 'multi_checkbox',\n\t\t\t'choices'\t\t\t\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h1' => 'Heading 1',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h2' => 'Heading 2',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h3' => 'Heading 3',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h4' => 'Heading 4',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h5' => 'Heading 5',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h6' => 'Heading 6',\n\t\t\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t'des'\t\t\t\t\t\t=> __( 'Check which HTML headings automatically generated table of contents.', 'fixedtoc' )\n\t\t);\n\t}", "public function Header()\r\n\t{\r\n\t\t$this->Ln();\r\n\t\t$this->SetFont('Arial','',14);\r\n\t\t$this->Cell(170,7,\"Date :: \". $this->today_date ,1,0,'C');\r\n\t\t$this->Ln();\r\n\t\t$this->SetFont('Arial','',14); \r\n\t\t$this->MultiCell(170,8,\"Room Things Report \\n\".$this->title,1,'C');\r\n\t\t$this->Ln(5);\r\n\r\n\t}", "public function headingHtml(string $html): CustomTextCard\n {\n return $this->setMeta('headingHtml', $html);\n }", "public function setHeaderText($value)\n {\n if (is_array($value)) {\n $this->fields['options']['header_text_left'] = $value[0];\n $this->fields['options']['header_text_center'] = $value[1];\n $this->fields['options']['header_text_right'] = $value[2];\n } else {\n $this->fields['options']['header_text_left'] = $value;\n }\n }", "protected function getHeadingHtml() {\n\t\t$heading = '';\n\t\tif ( $this->isUserPage ) {\n\t\t\t// The heading is just the username without namespace\n\t\t\t$heading = $this->pageUser->getName();\n\t\t} else {\n\t\t\t$pageTitle = $this->getOutput()->getPageTitle();\n\t\t\tif ( $pageTitle ) {\n\t\t\t\t$heading = $pageTitle;\n\t\t\t}\n\t\t}\n\t\treturn Html::rawElement( 'h1', [ 'id' => 'section_0' ], $heading );\n\t}" ]
[ "0.7115865", "0.66175056", "0.6427874", "0.63250315", "0.60851115", "0.60145533", "0.59840727", "0.5885032", "0.58817357", "0.5842405", "0.58113235", "0.57994074", "0.57731843", "0.5755268", "0.57319266", "0.5720061", "0.56676507", "0.5650661", "0.5644111", "0.562266", "0.5596793", "0.5591294", "0.558926", "0.5550014", "0.5462944", "0.54232246", "0.54145426", "0.5402274", "0.5388943", "0.538517" ]
0.6902673
1
Make Day Column Headings Build the row of day headings using the $daysArray array.
private function makeDayHeadings() { $this->outArray['dayheadings'] = array(); $this->dayHeadings .= "\t<tr>\n"; foreach($this->daysArray as $day) { $this->dayHeadings .= "\t\t<th class=\"dayHeading\">$day</th>\n"; array_push($this->outArray['dayheadings'], $day); } $this->dayHeadings .= "\t</tr>\n"; $this->calWeekDays .= $this->dayHeadings; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function makeCalendarHead()\n\t{\n\t\tif(strlen($this->headerStr) < 1) {\n\t\t\t$head = \"\\t<tr>\\n\\t\\t<th colspan=\\\"7\\\" class=\\\"headerString\\\">\";\n\t\t\tif(!is_null($this->curDay)) {\n\t\t\t\t$head .= $this->curDayName.' the '.$this->curDayS.' of '.$this->curMonthName.', '.$this->curYear;\n\t\t\t} else {\n\t\t\t\t$head .= $this->curMonthName.', '.$this->curYear;\n\t\t\t}\n\t\t\t$head .= \"</th>\\n\\t</tr>\\n\";\n\t\t} else {\n\t\t\t$head = $this->headerStr;\n\t\t}\n\t\t\n\t\t$this->calWeekDays .= $head;\n\t\t$this->outArray['head'] = $head;\n\t}", "private function makeCalendarTitle()\n\t{\n\t\tif(strlen($this->headerTitle) > 0) {\n\t\t\t$this->calWeekDays .= \"\\t<tr>\\n\\t\\t<th class=\\\"headerTitle\\\" colspan=\\\"7\\\">\".$this->headerTitle.\"</th>\\n\\t</tr>\";\n\t\t\t$this->outArray['title'] = $this->headerTitle;\n\t\t}\n\t}", "private function buildBodyDay()\n {\n\n $events = $this->events;\n $h = \"\";\n for ($i = $this->start_hour; $i < $this->end_hour; $i++) {\n for ($t = 0; $t < 2; $t++) {\n $h .= \"<tr>\";\n $min = $t == 0 ? \":00\" : \":30\";\n $h .= \"<td class='$this->timeClass'>\" . date('g:ia', strtotime($i . $min)) . \"</td>\";\n for ($k = 0; $k < 1; $k++) {\n $wd = $this->week_days[$k];\n $time_r = $this->year . '-' . $this->month . '-' . $wd . ' ' . $i . ':00:00';\n $min = $t == 0 ? '' : '+30 minute';\n $time_1 = strtotime($time_r . $min);\n $time_2 = strtotime(date('Y-m-d H:i:s', $time_1) . '+30 minute');\n $dt = date('Y-m-d H:i:s', $time_1);\n $h .= \"<td colspan='3' data-datetime='$dt'>\";\n $h .= $this->dateWrap[0];\n\n $hasEvent = false;\n foreach ($events as $key => $event) {\n //EVENT TIME AND DATE\n $time_e = strtotime($key);\n if ($time_e >= $time_1 && $time_e < $time_2) {\n $hasEvent = true;\n $h .= $this->buildEvents(false, $event);\n }\n }\n $h .= !$hasEvent ? '&nbsp;' : '';\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n $h .= \"</tr>\";\n }\n }\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n\n $this->html .= $h;\n }", "private function _createLabels ()\n {\n $content = '';\n\n foreach ($this->dayLabels as $label)\n {\n $content .= Html::tag('td', $label);\n }\n\n return Html::tag('tr', $content).\"\\n\";\n }", "function mkDays ($numDays, $month, $year) {\n for ($i = 1; $i <= $numDays; $i++) {\n $eachDay[$i] = $i; \n }\n foreach($eachDay as $day => &$wkday) {\n $wkday = date(\"w\", mktime(0,0,0,$month,$day,$year));\n }\n foreach($eachDay as $day=>&$wkday) {\n echo \"<table class='box' id=$day month=$month year=$year>\";\n echo \"<td>\";\n echo $day;\n echo \"</td>\";\n echo \"</table>\";\n }\n }", "function mkWeekDays(){\n\tif ($this->startOnSun){\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=0;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t}\n\telse{\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=1;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName(0).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t\t$this->firstday=$this->firstday-1;\n\t\tif ($this->firstday<0) $this->firstday=6;\n\t}\nreturn $out;\n}", "private function getWeekDays()\n {\n $time = date('Y-m-d', strtotime($this->year . '-' . $this->month . '-' . $this->day));\n if ($this->view == 'week') {\n $sunday = strtotime('last sunday', strtotime($time . ' +1day'));\n $day = date('j', $sunday);\n $startingDay = date('N', $sunday);\n $cnt = 6;\n }\n if ($this->view == 'day') {\n $day = $this->day;\n $cnt = 0;\n }\n\n $this->week_days = array();\n $mlen = $this->daysMonth[intval($this->month) - 1];\n if ($this->month == 2 && ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)))) {\n $mlen = $mlen + 1;\n }\n $h = \"<tr class='\" . $this->labelsClass . \"'>\";\n $h .= \"<td>&nbsp;</td>\";\n for ($j = 0; $j <= $cnt; $j++) {\n $cs = $cnt == 0 ? 3 : 1;\n $h .= \"<td colspan='$cs'>\";\n if ($this->view == 'day') {\n $getDayNumber = date('w', strtotime($time));\n } else {\n $getDayNumber = $j;\n }\n if ($day <= $mlen) {\n } else {\n $day = 1;\n }\n $h .= $this->dayLabels[$getDayNumber] . ' ';\n $h .= intval($day);\n $this->week_days[] = $day;\n $day++;\n $h .= \"</td>\";\n }\n\n $h .= \"</tr>\";\n return $h;\n }", "public static function make_table_header(Array $headings){\n\t\t$html = Xml::openElement( 'thead' );\n $html .= Xml::openElement( 'tr' );\n foreach ( $headings as $heading ) {\n $html .= Xml::element( 'th', array(), $heading );\n\t\t}\n $html .= Xml::closeElement( 'tr' );\n $html .= Xml::closeElement( 'thead' );\n\t\treturn $html;\n\t}", "private function makeArrayIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\t\t\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'normalDay';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'weekendDay';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'currentDay';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t} \n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['dayname'] = $this->daysArray[$this->weekDayNum - 1];\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['weekdaynumber'] = $this->weekDayNum;\n\t\t\t\t\t\t\t\t\t\n\t\t\t// Draw days\n\t\t\tif($this->makeDayEventListArray()) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['events'] = $this->makeDayEventListArray();\n\t\t\t}\n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['datestamp'] = $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth;\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "static function getDayTotals($dataArray, $dayHeaders) {\n $dayTotals = array();\n\n // Insert label.\n global $i18n;\n $dayTotals['label'] = $i18n->get('label.day_total').':';\n\n foreach ($dataArray as $row) {\n foreach($dayHeaders as $dayHeader) {\n if (array_key_exists($dayHeader, $row)) {\n $minutes = ttTimeHelper::toMinutes($row[$dayHeader]['duration']);\n $dayTotals[$dayHeader] += $minutes;\n }\n }\n }\n // Convert minutes to hh:mm for display.\n foreach($dayHeaders as $dayHeader) {\n $dayTotals[$dayHeader] = ttTimeHelper::minutesToDuration($dayTotals[$dayHeader]);\n }\n return $dayTotals;\n }", "private function buildBody()\n {\n $day = 1;\n $now_date = $this->year . '-' . $this->month . '-01';\n $startingDay = date('N', strtotime('first day of this month', strtotime($now_date)));\n //Add the following line if you want to start the week with monday instead of sunday. Or change the number to suit your needs.\n //$startingDay = $startingDay - 1;\n $monthLength = $this->daysMonth[$this->month - 1];\n if ($this->month == 2 && ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)))) {\n $monthLength = $monthLength + 1;\n }\n $h = \"<tr>\";\n for ($i = $startingDay == 7 ? 1 : 0; $i < 9; $i++) {\n for ($j = 0; $j <= 6; $j++) {\n $currDate = $this->getDayDate($day);\n $class = $this->getTdClass($day);\n $h .= \"<td data-datetime='$currDate' $class>\";\n $h .= $this->dateWrap[0];\n if ($day <= $monthLength && ($i > 0 || $j >= $startingDay)) {\n $h .= $this->dayWrap[0];\n $h .= $this->getEventSearchLink($day);\n $h .= $this->dayWrap[1];\n $h .= $this->buildEvents($currDate);\n $day++;\n } else {\n $h .= \"&nbsp;\";\n }\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n // stop making rows if we've run out of days\n if ($day > $monthLength) {\n break;\n } else {\n $h .= \"</tr>\";\n $h .= \"<tr>\";\n }\n }\n $h .= \"</tr>\";\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n $this->html .= $h;\n }", "private function generateHeading()\n {\n //get current dimensions\n\t\t$highestRow = $this->objWorksheet->getHighestRow(); // e.g. 10\n\t\t$highestColumn = $this->objWorksheet->getHighestColumn(); // e.g 'F'\n\n\t\t$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);\n\n\t\t//insert row on top\n\t\t$this->objWorksheet->insertNewRowBefore(1,2);\n\n\t\t//merge cells\n\t\t$this->objWorksheet->mergeCells(\"A1:\".$highestColumn.\"1\");\n\n\t\t//set the text for header\n\t\t$this->objWorksheet->setCellValue(\"A1\", $this->_headingText);\n\t\t$this->objWorksheet->getStyle('A1')->getAlignment()->setWrapText(true);\n\t\t$this->objWorksheet->getRowDimension('1')->setRowHeight(48);\n\n //Apply style\n\t\t$this->objWorksheet->getStyle(\"A1\")->applyFromArray($this->_headingStyleArray);\n }", "function BeginIncidentTable() {\n $headings = array(\"Year\", \"Section\", \"Description\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\", \"Count\");\n echo \"<table class='sortable' align='center' cellpadding='5' border=1>\";\n echo \"<tr>\";\n foreach ($headings as $heading) {\n echo \"<th>$heading</th>\";\n }\n echo \"</tr>\";\n}", "function build_calendar($month,$year,$dateArray) {\r\n $daysOfWeek = array('S','M','T','W','T','F','S');\r\n\r\n // What is the first day of the month in question?\r\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\r\n\r\n // How many days does this month contain?\r\n $numberDays = date('t',$firstDayOfMonth);\r\n\r\n // Retrieve some information about the first day of the\r\n // month in question.\r\n $dateComponents = getdate($firstDayOfMonth);\r\n\r\n // What is the name of the month in question?\r\n $monthName = $dateComponents['month'];\r\n\r\n // What is the index value (0-6) of the first day of the\r\n // month in question.\r\n $dayOfWeek = $dateComponents['wday'];\r\n\r\n // Create the table tag opener and day headers\r\n\r\n $calendar = \"<table class='table table-bordered'>\";\r\n $calendar .= \"<caption>$monthName $year</caption>\";\r\n $calendar .= \"<tr>\";\r\n\r\n // Create the calendar headers\r\n\r\n foreach($daysOfWeek as $day) {\r\n $calendar .= \"<th class='header'>$day</th>\";\r\n } \r\n\r\n // Create the rest of the calendar\r\n\r\n // Initiate the day counter, starting with the 1st.\r\n\r\n $currentDay = 1;\r\n\r\n $calendar .= \"</tr><tr>\";\r\n\r\n // The variable $dayOfWeek is used to\r\n // ensure that the calendar\r\n // display consists of exactly 7 columns.\r\n\r\n if ($dayOfWeek > 0) { \r\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\"; \r\n }\r\n \r\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\r\n \r\n while ($currentDay <= $numberDays) {\r\n\r\n // Seventh column (Saturday) reached. Start a new row.\r\n\r\n if ($dayOfWeek == 7) {\r\n\r\n $dayOfWeek = 0;\r\n $calendar .= \"</tr><tr>\";\r\n\r\n }\r\n \r\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\r\n \r\n $date = \"$year-$month-$currentDayRel\";\r\n\t\tif($date == date('Y-m-d')){\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date' bgcolor='#ADD8E6'>$currentDay<br/>\";\r\n\t\t}else{\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date'>$currentDay<br/>\";\r\n\t\t}\r\n \r\n\t\t $sql = mysql_query(\"SELECT * FROM leavesys.leave_details WHERE date = '\".$date.\"'\");\r\n\t\t while($result = mysql_fetch_array($sql)){\r\n\t\t\t $sql2 = mysql_query(\"SELECT * FROM user WHERE id = '\".$result['applicant_id'].\"'\");\r\n\t\t\t $result2 = mysql_fetch_assoc($sql2);\r\n\t\t\t\tif($result['half'] == 1){\r\n\t\t\t\t\t$c_content = \" (am)\";\r\n\t\t\t\t}else if($result['half'] == 2){\r\n\t\t\t\t\t$c_content = \" (pm)\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$c_content = \"\";\r\n\t\t\t\t}\r\n\t\t\t\t$calendar .= $result2['country_code'].\" - \".$result2['name'].$c_content.\"<br/>\";\r\n\t\t }\r\n\t\t $sql1 = mysql_query(\"SELECT * FROM leavesys.holiday WHERE date = '\".$date.\"'\");\r\n\t\t while($result1 = mysql_fetch_array($sql1)){\r\n\t\t\t if($result1['country'] == \"al\"){\r\n\t\t\t\t $calendar .= \"<font color='blue;'>\".$result1['name'].\"</font><br/>\";\r\n\t\t\t }else{\r\n\t\t\t\t$calendar .= \"<font color='blue;'>\".$result1['name'].\" (\".$result1['country'].\")</font><br/>\";\r\n\t\t\t }\r\n\t\t }\r\n\t\t $calendar .= \"</td>\";\r\n\r\n // Increment counters\r\n \r\n $currentDay++;\r\n $dayOfWeek++;\r\n\r\n }\r\n \r\n \r\n\r\n // Complete the row of the last week in month, if necessary\r\n\r\n if ($dayOfWeek != 7) { \r\n \r\n $remainingDays = 7 - $dayOfWeek;\r\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\"; \r\n\r\n }\r\n \r\n $calendar .= \"</tr>\";\r\n\r\n $calendar .= \"</table>\";\r\n\r\n return $calendar;\r\n\r\n}", "function build_month_days($month, $number_of_days) {\r\n $days_of_month_html = '<tr class=\"week-day\">';\r\n \r\n $days_in_week = 1;\r\n for ($days = 1; $days <= $number_of_days; $days++) {\r\n\r\n // Split the weeks in rows\r\n if ($days_in_week == 8) {\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n $days_of_month_html = $days_of_month_html . '<tr class=\"week-day\">'; \r\n $days_in_week = 1;\r\n }\r\n\r\n // Render days of week in the correct position\r\n if ($days == 1) {\r\n $initial_position = get_first_day($month);\r\n for($i = 1; $i < $initial_position; $i++) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\"></td>';\r\n $days_in_week++;\r\n }\r\n if ($initial_position == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>';\r\n }\r\n } else if ($days_in_week == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>'; \r\n }\r\n\r\n $days_in_week++;\r\n }\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n \r\n return $days_of_month_html;\r\n }", "protected function compileWeeks()\n\t{\n\t\t$intDaysInMonth = date('t', $this->Date->monthBegin);\n\t\t$intFirstDayOffset = date('w', $this->Date->monthBegin) - $this->cal_startDay;\n\n\t\tif ($intFirstDayOffset < 0)\n\t\t{\n\t\t\t$intFirstDayOffset += 7;\n\t\t}\n\n\t\t$intColumnCount = -1;\n\t\t$intNumberOfRows = ceil(($intDaysInMonth + $intFirstDayOffset) / 7);\n\t\t$arrAllEvents = $this->getAllEvents($this->iso_arrEventIDs, $this->cal_calendar, $this->Date->monthBegin, $this->Date->monthEnd);\n\t\t\n\t\t$arrDays = array();\n\n\t\t// Compile days\n\t\tfor ($i=1; $i<=($intNumberOfRows * 7); $i++)\n\t\t{\n\t\t\t$intWeek = floor(++$intColumnCount / 7);\n\t\t\t$intDay = $i - $intFirstDayOffset;\n\t\t\t$intCurrentDay = ($i + $this->cal_startDay) % 7;\n\n\t\t\t$strWeekClass = 'week_' . $intWeek;\n\t\t\t$strWeekClass .= ($intWeek == 0) ? ' first' : '';\n\t\t\t$strWeekClass .= ($intWeek == ($intNumberOfRows - 1)) ? ' last' : '';\n\n\t\t\t$strClass = ($intCurrentDay < 2) ? ' weekend' : '';\n\t\t\t$strClass .= ($i == 1 || $i == 8 || $i == 15 || $i == 22 || $i == 29 || $i == 36) ? ' col_first' : '';\n\t\t\t$strClass .= ($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) ? ' col_last' : '';\n\n\t\t\t// Empty cell\n\t\t\tif ($intDay < 1 || $intDay > $intDaysInMonth)\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = '&nbsp;';\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days empty' . $strClass ;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$intKey = date('Ym', $this->Date->tstamp) . ((strlen($intDay) < 2) ? '0' . $intDay : $intDay);\n\t\t\t$strClass .= ($intKey == date('Ymd')) ? ' today' : '';\n\n\t\t\t// Mark the selected day (see #1784)\n\t\t\tif ($intKey == $this->Input->get('day'))\n\t\t\t{\n\t\t\t\t$strClass .= ' selected';\n\t\t\t}\n\n\t\t\t// Inactive days\n\t\t\tif (empty($intKey) || !isset($arrAllEvents[$intKey]))\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days' . $strClass;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$arrEvents = array();\n\n\t\t\t// Get all events of a day\n\t\t\tforeach ($arrAllEvents[$intKey] as $v)\n\t\t\t{\n\t\t\t\tforeach ($v as $vv)\n\t\t\t\t{\n\t\t\t\t\t$arrEvents[] = $vv;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days active' . $strClass;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['href'] = $this->strUrl . ($GLOBALS['TL_CONFIG']['disableAlias'] ? '?id=' . $this->Input->get('id') . '&amp;' : '?') . 'day=' . $intKey;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['title'] = sprintf(specialchars($GLOBALS['TL_LANG']['MSC']['cal_events']), count($arrEvents));\n\t\t\t$arrDays[$strWeekClass][$i]['events'] = $arrEvents;\n\t\t}\n\n\t\treturn $arrDays;\n\t}", "private function buildHeader()\n {\n $month_name = $this->monthLabels[$this->month - 1] . ' ' . $this->year;\n $vclass = strtolower($this->view);\n $h = \"<table class='\" . $this->tableClass . \" \" . $vclass . \"'>\";\n $h .= \"<thead>\";\n $h .= \"<tr class='\" . $this->headClass . \"'>\";\n $cs = 5;\n if ($this->view == 'week' || $this->view == 'day') {\n $h .= \"<th>&nbsp;</th>\";\n }\n if ($this->view == 'day') {\n $cs = 1;\n }\n\n if ($this->nav) {\n $h .= \"<th>\";\n $h .= \"<a class='\" . $this->prevClass . \"' href='\" . $this->prevLink() . \"'>\" . $this->prevIco . \"</a>\";\n $h .= \"</th>\";\n $h .= \"<th colspan='$cs'>\";\n $h .= $month_name;\n $h .= \"</th>\";\n $h .= \"<th>\";\n $h .= \"<a class='\" . $this->nextClass . \"' href='\" . $this->nextLink() . \"'>\" . $this->nextIco . \"</a>\";\n $h .= \"</th>\";\n } else {\n $h .= \"<th colspan='7'>\";\n $h .= $month_name;\n $h .= \"</th>\";\n }\n $h .= \"</tr>\";\n $h .= \"</thead>\";\n\n $h .= \"<tbody>\";\n if ($this->view != 'day' && $this->view != 'week') {\n $h .= \"<tr class='\" . $this->labelsClass . \"'>\";\n\n for ($i = 0; $i <= 6; $i++) {\n $h .= \"<td>\";\n $h .= $this->dayLabels[$i];\n $h .= \"</td>\";\n }\n\n $h .= \"</tr>\";\n }\n if ($this->view == 'day' || $this->view == 'week') {\n $h .= self::getWeekDays();\n }\n\n $this->html .= $h;\n }", "private function makeHTMLIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$style = 'class=\"normalDay\"';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$style = 'class=\"weekendDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$style = 'class=\"currentDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->calWeekDays .= \"\\t</tr>\\n\\t<tr>\\n\";\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t}\n\n\t\t\t// Draw days\n\t\t\t$this->calWeekDays .= \"\\t\\t<td valign=\\\"top\\\" \".$style.'>'.$this->dayOfMonth;\n\t\t\t\n\t\t\tif($this->addWeekDay) {\n\t\t\t\t$this->calWeekDays .= \"|\".$this->weekDayNum;\n\t\t\t}\n\t\t\t\n\t\t\tif(strlen($this->addEvtDest) > 0) {\n\t\t\t\t$addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src=\"'.$this->addEvtImg.'\" class=\"addevtimg\" />' : '+');\n\t\t\t\t$this->calWeekDays .= '[<a href=\"'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'\" title=\"Add Event\" class=\"addevt\">'.$addevtimg.'</a>]';\n\t\t\t}\n\t\t\t\n\t\t\t$this->calWeekDays .= \" \".$this->makeDayEventListHTML().\"</td>\\n\";\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "private function setDayNames()\n\t{\n\t $range = range(1,7);\n\t $return = array();\n\t foreach($range AS $key => $dayNum)\n\t {\n\t \t$fmt = datefmt_create ($this->locale, null, null, null, IntlDateFormatter::GREGORIAN, 'eee');\n\t \t$key = strtolower(datefmt_format( $fmt , mktime(12,0,0,4,$dayNum+5,2014))); //we force the date so things start on Sunday\n\t \t\n\t \t$fmt = datefmt_create ($this->locale, null, null, null, IntlDateFormatter::GREGORIAN, 'EEEE');\n\t \t$return[$key] = datefmt_format( $fmt , mktime(12,0,0,4,$dayNum+5,2014));\n\t }\n\n\t return $return;\n\t}", "function createTable($array,$summary,$caption,$id='',$class='') {\n\tif(!is_array($array) || empty($summary) || empty($caption)) return false;\n\t\n\t$thead_text = '';\n\t$tbody_text = '';\n\n\t$header_total = count($array['header']);\n\tforeach($array['header'] as $key => $header) {\n\t\tif(!is_array($header)) $header = array('text' => $header);\n\t\t$thead_text .= '<th scope=\"col\"'.addAttributes(@$header['title'],$header['id'],@$header['class']).'>'.formatText($header['text']).'</th>'.\"\\n\";\n\t}\n\n\t$i=0;\n\tforeach($array['rows'] as $key => $row_array) {\n\t\t$tbody_row = '';\n\t\tif(empty($row_array['class'])) $row_array['class'] = array();\n\t\telseif(!is_array($row_array['class'])) $row_array['class'] = array($row_array['class']);\n\t\tif(!isEven($i)) $row_array['class'][] = 'odd';\n\n\t\tif(count($row_array['value'])!=$header_total) continue; // if the number of rows don't match header rows...\n\t\tforeach($row_array['value'] as $key => $row) {\n\t\t\tif(!is_array($row)) $row = array('text' => $row);\n\t\t\t$tbody_row .= '<td headers=\"'.$array['header'][$key]['id'].'\"'.addAttributes('',@$row['id'],@$row['class']).'>'.$row['text'].'</td>'.\"\\n\";\n\t\t}\n\t\t$tbody_text .= '<tr'.addAttributes('',@$row_array['id'],@$row_array['class']).'>'.\"\\n\".$tbody_row.'</tr>'.\"\\n\";\n\t\t$i++;\n\t}\n\tif(empty($tbody_text)) return false;\n\t\n\t$table = '<table summary=\"'.formatText($summary).'\"'.addAttributes('',$id,$class).'>\n\t\t<caption>'.formatText($caption).'</caption>\n\t\t<thead>'.\"\\n\".'<tr>'.\"\\n\".$thead_text.'</tr>'.\"\\n\".'</thead>\n\t\t<tbody>'.\"\\n\".$tbody_text.'</tbody>\n\t</table>'.\"\\n\";\n\t\n\treturn $table;\n}", "function getColumnHeaders(){\n\t\t$columnHeaders = array();\n\n\t\t//fixed headers\n\t\t$columnHeaders[0] = 'User';\n\t\t$columnHeaders[1] = 'Action';\n\n\t\t//two headers were added, offsett to make up for it\n\t\t$count = 2;\n\t\tforeach ($this->schedule as $date => $times) {\n\n\t\t\t//convert the full date to a more readable version\n\t\t\t$converter = strtotime($date); \n\t\t\t$formattedDate =date('l', $converter);\n\t\t\t$formattedDate = $formattedDate.'</br>'.date('m-d-y', $converter);\n\n\t\t\tforeach($times as $time){// #2dimensionlswag\n\n\t\t\t\t//convert the international time to AM/PM\n\t\t\t\t$converter = strtotime($time); \n\t\t\t\t$formattedTime = date(\"g:i A\", $converter);\n\n\t\t\t\t$columnHeaders[$count] = $formattedDate.'</br>'.$formattedTime;\n\t\t\t\t$count++;\n\t\t\t}\n\t\t}\n\t\treturn $columnHeaders;\n\t}", "function build_calendar($month,$year,$dateArray) {\n $daysOfWeek = array('S','M','T','W','T','F','S');\n\n // What is the first day of the month in question?\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\n\n // How many days does this month contain?\n $numberDays = date('t',$firstDayOfMonth);\n\n // Retrieve some information about the first day of the\n // month in question.\n $dateComponents = getdate($firstDayOfMonth);\n\n // What is the name of the month in question?\n $monthName = $dateComponents['month'];\n\n // What is the index value (0-6) of the first day of the\n // month in question.\n $dayOfWeek = $dateComponents['wday'];\n\n // Create the table tag opener and day headers\n\n $calendar = \"<table class='calendar'>\";\n $calendar .= \"<caption>$monthName $year</caption>\";\n $calendar .= \"<tr>\";\n\n // Create the calendar headers\n\n foreach($daysOfWeek as $day) {\n $calendar .= \"<th class='header'>$day</th>\";\n }\n\n // Create the rest of the calendar\n\n // Initiate the day counter, starting with the 1st.\n\n $currentDay = 1;\n\n $calendar .= \"</tr><tr>\";\n\n // The variable $dayOfWeek is used to\n // ensure that the calendar\n // display consists of exactly 7 columns.\n\n if ($dayOfWeek > 0) {\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\";\n }\n\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\n\n while ($currentDay <= $numberDays) {\n\n // Seventh column (Saturday) reached. Start a new row.\n\n if ($dayOfWeek == 7) {\n\n $dayOfWeek = 0;\n $calendar .= \"</tr><tr>\";\n\n }\n\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\n\n $date = \"$year-$month-$currentDayRel\";\n\n $calendar .= \"<td class='day' rel='$date'>$currentDay</td>\";\n\n // Increment counters\n\n $currentDay++;\n $dayOfWeek++;\n\n }\n\n\n\n // Complete the row of the last week in month, if necessary\n\n if ($dayOfWeek != 7) {\n\n $remainingDays = 7 - $dayOfWeek;\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\";\n\n }\n\n $calendar .= \"</tr>\";\n\n $calendar .= \"</table>\";\n\n return $calendar;\n\n}", "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}", "function buildRow($network){\n $offset = 0;\n $i = 0;\n while($i < 7){\n $currentTitle = getTitle($network, getTime($offset));\n if (count($currentTitle) == 0){\n echo '<td colspan=\"1\">Local Programming</td>';\n $collumns = 1;\n $offset += 30;\n }\n else{\n $collumns = (int)($currentTitle[0]['RUNTIME'] / 30);\n if($i + $collumns > 7 ){\n $collumns = 2;\n }\n else if ($i + $collumns == 7){\n $collumns += 1;\n }\n echo '<td colspan=\"'. $collumns.'\"><a href = \"/phase5/pages/info.php?id= ' . $currentTitle[0]['ID']. '\">' . $currentTitle[0]['TITLE'] . '</td> ';\n $offset += $currentTitle[0]['RUNTIME'] ;\n }\n $i += $collumns; \n }\n}", "public function generateTable($myTableArrayBody) {\n\t\t\t $x = 0;\n\t\t\t $y = 0;\n\t\t\t $seTableStr = '<table><caption><h3>HAVANAO PAYMENT DETAILS</h3></caption><tbody>';\t\t \n\t\t\t foreach ($myTableArrayBody as $key => $value) {\n\t\t\t \t$seTableStr = $seTableStr.'<tr><th>'.strtoupper($key).'</th><td>'.$value.'</td></tr>';\n\t\t\t }\n\t\t\t $seTableStr .= '</tbody></table>';\n\t\t\t return $seTableStr;\n\t\t\t}", "public static function column_headings( $columns ) {\n\n\t\t\tunset( $columns['date'] );\n\n\t\t\t$columns['advanced_headers_display_rules'] = __( 'Display Rules', 'astra-addon' );\n\t\t\t$columns['date'] = __( 'Date', 'astra-addon' );\n\n\t\t\treturn $columns;\n\t\t}", "static function getDayHeadersForWeek($start_date) {\n $dayHeaders = array();\n $objDate = new DateAndTime(DB_DATEFORMAT, $start_date);\n $dayHeaders[] = (string) $objDate->getDate(); // It returns an int on first call.\n if (strlen($dayHeaders[0]) == 1) // Which is an implementation detail of DateAndTime class.\n $dayHeaders[0] = '0'.$dayHeaders[0]; // Add a 0 for single digit day.\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate(); // After incDay it returns a string with leading 0, when necessary.\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate();\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate();\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate();\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate();\n $objDate->incDay();\n $dayHeaders[] = $objDate->getDate();\n unset($objDate);\n return $dayHeaders;\n }", "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 static function displayCalender($array)\n {\n echo \"Sun Mon Tue Wed Thu Fri Sat\\n\";\n for ($i = 0; $i < 6; $i++) \n {\n for ($j = 0; $j < 7; $j++) \n {\n if ($array[$i][$j] == '-' || $array[$i][$j] > 31) \n {\n //replacing with spaces\n echo \" \";\n } \n else \n {\n if ($array[$i][$j] < 10) \n {\n //giving 5 space after single digit\n echo $array[$i][$j] . \" \";\n } \n else \n {\n //giving 4 space after two digit number\n echo $array[$i][$j] . \" \";\n }\n }\n }\n echo \"\\n\";\n }\n }", "public static function create_table_head()\n\t{\n\t\t\n\t\tif (!static::$columns)\n\t\t{\n\t\t\treturn static::$template['wrapper_start'].'<tr><th>No columns config</th></tr>'.static::$template['wrapper_end'];\n\t\t}\n\n\t\t$table_head = static::$template['wrapper_start'];\n\t\t$table_head .= '<tr>';\n\t\t\n\t\tforeach(static::$columns as $column)\n\t\t{\n\t\t\t$sort_key \t= (is_array($column) ? isset($column[1]) ? $column[1] : strtolower($column[0]) : $column);\n\t\t\t$col_attr\t= (is_array($column) && isset($column[2]) ? $column[2] : array());\n\t\t\t\n\t\t\t$new_direction = static::$direction;\n\t\t\t\n\t\t\tif(static::$sort_by == $sort_key)\n\t\t\t{\n\t\t\t\t$active_class_name = static::$template['col_class_active'].' '.static::$template['col_class_active'].'_'.$new_direction;\n\t\t\t\tif(isset($col_attr['class']))\n\t\t\t\t{\n\t\t\t\t\t$col_attr['class'] .= ' '.$active_class_name;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\t$col_attr['class'] = $active_class_name;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$new_direction = (static::$direction == 'asc' ? 'desc' : 'asc');\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(is_array($column) && (!isset($column[1]) || isset($column[1]) && $column[1] !== false)){\n\t\t\t\t\n\t\t\t\t$url \t\t\t= rtrim(static::$base_url, '/').(static::$current_page ? '/'.static::$current_page : '');\n\t\t\t\t$url \t\t\t.= '/'.$sort_key.static::$uri_delimiter.$new_direction;\n\t\t\t\t\n\t\t\t\t$cell_content \t= rtrim(static::$template['link_start'], '> ').' href=\"'.$url.'\">';\n\t\t\t\t$cell_content \t.= $column[0];\n\t\t\t\t$cell_content \t.= static::$template['link_end'];\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tif(is_array($column))\n\t\t\t\t{\n\t\t\t\t\t$column = $column[0];\n\t\t\t\t}\n\t\t\t\t$cell_content = static::$template['nolink_start'].$column.static::$template['nolink_end'];\t\n\t\t\t}\n\t\t\t\n\t\t\t$table_head .= html_tag(static::$template['col_tag'], $col_attr, $cell_content);\n\t\t\t\n\t\t}\n\t\t\n\t\t$table_head .= '</tr>';\n\t\t$table_head .= static::$template['wrapper_end'];\n\n\t\treturn $table_head;\n\t}" ]
[ "0.6407736", "0.59913987", "0.59694207", "0.5830636", "0.580982", "0.5785261", "0.57791615", "0.5628445", "0.5607434", "0.551453", "0.55088216", "0.5440747", "0.54331005", "0.54277366", "0.5427073", "0.54121625", "0.539174", "0.5388485", "0.53517675", "0.5342108", "0.53218204", "0.53132296", "0.5269427", "0.5238228", "0.52347237", "0.52317595", "0.52274734", "0.5206592", "0.51989573", "0.5186882" ]
0.8538074
0
Set start of month spacers Create a spacer cell that adds blank space for the start of the month before the first day of the month.
private function startMonthSpacers() { if($this->firstDayOfTheMonth != '0') { $this->calWeekDays .= "\t\t<td colspan=\"".$this->firstDayOfTheMonth."\" class=\"spacerDays\">&nbsp;</td>\n"; $this->outArray['firstday'] = $this->firstDayOfTheMonth; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function endMonthSpacers()\n\t{\n\t\tif((8 - $this->weekDayNum) >= '1') {\n\t\t\t$this->calWeekDays .= \"\\t\\t<td colspan=\\\"\".(8 - $this->weekDayNum).\"\\\" class=\\\"spacerDays\\\">&nbsp;</td>\\n\";\n\t\t\t$this->outArray['lastday'] = (8 - $this->weekDayNum);\t\t\t\n\t\t}\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}", "public function setStartMonth($value)\n {\n return $this->setParameter('startMonth', (int) $value);\n }", "public function setStartMonth($month)\n {\n $this->start_month = $month;\n $date = date('Y', time()) . '-' . $month . '-01';\n $this->start_date = new DateTime($date);\n }", "public static function data_first_month() {\n\t$month = date('m');\n\t$year = date('Y');\n\treturn date('Y-m-d', mktime(0,0,0, $month, 1, $year));\n}", "public function hasStartMonth() {\n return $this->_has(5);\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 }", "function mkMonthHead(){\nreturn \"<table class=\\\"\".$this->cssMonthTable.\"\\\">\\n\";\n}", "public function monthPadDates()\n {\n return date('w', strtotime(date('Y-m-01', strtotime($this->strStart))));\n }", "function print_calendar($mon,$year)\n\t{\n\t\tglobal $dates, $first_day, $start_day;\n\t\t\t$cellWidth =\"150\";\n\t\t$first_day = mktime(0,0,0,$mon,1,$year);\n\t\t$start_day = date(\"w\",$first_day);\n\t\t$res = getdate($first_day);\n\t\t$month_name = $res[\"month\"];\n\t\t$no_days_in_month = date(\"t\",$first_day);\n\t\t\n\t\t//If month's first day does not start with first Sunday, fill table cell with a space\n\t\tfor ($i = 1; $i <= $start_day;$i++)\n\t\t\t$dates[1][$i] = \" \";\n\n\t\t$row = 1;\n\t\t$col = $start_day+1;\n\t\t$num = 1;\n\t\twhile($num<=31)\n\t\t\t{\n\t\t\t\tif ($num > $no_days_in_month)\n\t\t\t\t\t break;\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$dates[$row][$col] = $num;\n\t\t\t\t\t\tif (($col + 1) > 7)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$row++;\n\t\t\t\t\t\t\t\t$col = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$col++;\n\t\t\t\t\t\t$num++;\n\t\t\t\t\t}//if-else\n\t\t\t}//while\n\t\t$mon_num = date(\"n\",$first_day);\n\t\t$temp_yr = $next_yr = $prev_yr = $year;\n\n\t\t$prev = $mon_num - 1;\n\t\t$next = $mon_num + 1;\n\n\t\t//If January is currently displayed, month previous is December of previous year\n\t\tif ($mon_num == 1)\n\t\t\t{\n\t\t\t\t$prev_yr = $year - 1;\n\t\t\t\t$prev = 12;\n\t\t\t}\n \n\t\t//If December is currently displayed, month next is January of next year\n\t\tif ($mon_num == 12)\n\t\t\t{\n\t\t\t\t$next_yr = $year + 1;\n\t\t\t\t$next = 1;\n\t\t\t}\n\n\t\techo \"<DIV ALIGN='center'><TABLE BORDER=1 WIDTH=1600px CELLSPACING=0 BORDERCOLOR='silver'>\";\n\n\t\techo \t\"\\n<TR ALIGN='center'><TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$prev&year=$prev_yr' STYLE=\\\"text-decoration: none\\\"><B><<</B></A> </TD>\".\n\t\t\t \"<TD COLSPAN=5 BGCOLOR='#99CCFF'><B>\".date(\"F\",$first_day).\" \".$temp_yr.\"</B></TD>\".\n\t\t\t \"<TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$next&year=$next_yr' STYLE=\\\"text-decoration: none\\\"><B>>></B></A> </TD></TR>\";\n\n\t\techo \"\\n<TR ALIGN='center'><TD width='$cellWidth'><B>Domenica</B></TD><TD width='$cellWidth'><B>Lunedi</B></TD><TD width='$cellWidth'><B>Martedi</B></TD>\";\n\t\techo \"<TD width='$cellWidth'><B>Mercoledi</B></TD><TD width='$cellWidth'><B>Giovedi</B></TD><TD width='$cellWidth'><B>Venerdi</B></TD><TD width='$cellWidth'><B>Sabato</B></TD></TR>\";\n\t\techo \"<TR><TD COLSPAN=7> </TR><TR height='100px;' ALIGN='center'>\";\n\t\t\t\t\n\t\t$end = ($start_day > 4)? 6:5;\n\t\tfor ($row=1;$row<=$end;$row++)\n\t\t\t{\n\t\t\t\tfor ($col=1;$col<=7;$col++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($dates[$row][$col] == \"\")\n\t\t\t\t\t\t$dates[$row][$col] = \" \";\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!strcmp($dates[$row][$col],\" \"))\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$t = $dates[$row][$col];\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//If date is today, highlight it\n\t\t\t\t\t\tif (($t == date(\"j\")) && ($mon == date(\"n\")) && ($year == date(\"Y\"))){\n\t\t\t\t\t\t\techo \"\\n<TD valign='top' BGCOLOR='aqua'><a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\";\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n }\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t//If the date is absent ie after 31, print space\n\t\t\t\t\t\t\techo \"\\n<TD valign='top'>\".(($t == \" \" )? \"&nbsp;\" : \"<a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\");\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n\t\t\t\t\t }\n }// for -col\n\t\t\t\t\n\t\t\t\tif (($row + 1) != ($end+1))\n\t\t\t\t\techo \"</TR>\\n<TR ALIGN='center' height='100px;'>\";\n\t\t\t\telse\n\t\t\t\t\techo \"</TR>\";\n\t\t\t}// for - row\n\t\techo \"\\n</TABLE><BR><BR><A HREF=\\\"index.php\\\">Visualizza mese corrente</A> </DIV>\";\n\t}", "public function setLeading($leading) {}", "public function getDateStartMonth($date=null){\n\t\t$dateNew = date(\"Y-m-d H:i:s\",strtotime('first day of this month', strtotime($date)));\n\t\treturn $dateNew;\n\t}", "public function getStartMonth()\n {\n return $this->getParameter('startMonth');\n }", "function single_month_title($prefix = '', $display = \\true)\n {\n }", "function _data_first_month_day()\n {\n $month = date('m');\n $year = date('Y');\n return date('Y-m-d', mktime(0, 0, 0, $month, 1, $year));\n }", "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 getNextMonth(){\n\t\tif($this->getMonth() == 12){return 1;}\n\t\telse{return $this->getMonth()+1;}\n\t}", "function _data_first_month_day() {\r\n $month = date('m');\r\n $year = date('Y');\r\n return date('d/m/Y', mktime(0,0,0, $month, 1, $year));\r\n }", "function mkMonthFoot(){\nreturn \"</table>\\n\";\n}", "public function snapToMonth(): self\n {\n return new self(\n DatePoint::fromDate($this->startDate)->month()->startDate(),\n DatePoint::fromDate($this->endDate)->month()->endDate(),\n $this->bounds\n );\n }", "function setMonth($m)\r\n {\r\n if($m < 1 || $m > 12) {\r\n $this->mes = 1;\r\n } else {\r\n $this->mes = $m;\r\n }\r\n }", "function _data_first_month_day() {\n\t$month = date('m');\n\t$year = date('Y');\n\treturn date('Y-m-d', mktime(0,0,0, $month, 1, $year));\n}", "function _putDateSchedules0502s($pdf, $font, $date1, $date2, $y) {\n if (!empty($date1)) {\n $y1 = date('Y', strtotime($date1)) - 1988;\n $m1 = date('n', strtotime($date1));\n $d1 = date('j', strtotime($date1));\n\n $pdf->SetFont($font, null, 9, true);\n $pdf->SetXY(32.4, $y);\n $pdf->MultiCell(10, 5, $y1, 0, 'C');\n $pdf->SetXY(41.4, $y);\n $pdf->MultiCell(10, 5, $m1, 0, 'C');\n $pdf->SetXY(49, $y);\n $pdf->MultiCell(10, 5, $d1, 0, 'C');\n }\n\n if (!empty($date2)) {\n $y2 = date('Y', strtotime($date2)) - 1988;\n $m2 = date('n', strtotime($date2));\n $d2 = date('j', strtotime($date2));\n\n $pdf->SetFont($font, null, 9, true);\n $pdf->SetXY(32.4, $y + 3);\n $pdf->MultiCell(10, 5, $y2, 0, 'C');\n $pdf->SetXY(41.4, $y + 3);\n $pdf->MultiCell(10, 5, $m2, 0, 'C');\n $pdf->SetXY(49, $y + 3);\n $pdf->MultiCell(10, 5, $d2, 0, 'C');\n }\n }", "protected function getTab() {\n return \" \";\n }", "protected function startDate()\n {\n $d = new DateTime('first day of last month');\n $d->setTime(0, 0, 0);\n return $d;\n }", "function mkYearBody($stmonth=false){\n\tif (!$stmonth || $stmonth>12) $stmonth=1;\n$TrMaker = $this->rowCount;\n$curyear = $this->actyear;\n$out=\"<tr>\\n\";\n\tfor ($x=1; $x<=12; $x++) {\n\t\t$this->activeCalendar($curyear,$stmonth,false,$this->GMTDiff);\n\t\t$out.=\"<td valign=\\\"top\\\">\\n\".$this->showMonth().\"</td>\\n\";\n\t\tif ($x == $TrMaker && $x < 12) {\n\t\t\t$out.=\"</tr><tr>\";\n\t\t\t$TrMaker = ($TrMaker+$this->rowCount);\n\t\t}\n\t\tif ($stmonth == 12) {\n\t\t\t$stmonth = 1;\n\t\t\t$curyear++;\n\t\t} \n\t\telse $stmonth++;\n\t}\n$out.=\"</tr>\\n\";\nreturn $out;\n}", "function mkMonth ($month) {\n $head = \"<div class='fullwidth'>\";\n $head .= \"<div class='month'>\";\n $head .= date(\"F\", mktime(0,0,0,$month));\n $head .= \"</div>\";\n $head .= \"<div id='jresult'>\";\n $head .= \"</div>\";\n $head .= \"<div id='week'>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Sunday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Monday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Tuesday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Wednesday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Thursday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Friday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"<table class='days'>\";\n $head .= \"<td>\";\n $head .= \"Saturday\";\n $head .= \"</td>\";\n $head .= \"</table>\";\n $head .= \"</div>\";\n echo $head;\n }", "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 nextMonth(): Month{\n $month = $this->month +1;\n $year=$this->year;\n if($month > 12){\n $month = 1;\n $year += 1;\n }\n return new Month($month, $year);\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}" ]
[ "0.5999289", "0.5799576", "0.55208194", "0.5462961", "0.54257184", "0.5403874", "0.53747106", "0.5319116", "0.52447367", "0.5152501", "0.5072927", "0.5065767", "0.49980766", "0.49827915", "0.49784622", "0.4928414", "0.49255168", "0.49203742", "0.4913131", "0.49100062", "0.49091643", "0.49039856", "0.48905474", "0.48887783", "0.48851857", "0.488058", "0.4856213", "0.4855926", "0.48525944", "0.4846326" ]
0.834585
0
Set end of month spacers Create a spacer cell that adds blank space for the end of the month after the last day of the month.
private function endMonthSpacers() { if((8 - $this->weekDayNum) >= '1') { $this->calWeekDays .= "\t\t<td colspan=\"".(8 - $this->weekDayNum)."\" class=\"spacerDays\">&nbsp;</td>\n"; $this->outArray['lastday'] = (8 - $this->weekDayNum); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function startMonthSpacers()\n\t{\n\t\tif($this->firstDayOfTheMonth != '0') {\n\t\t\t$this->calWeekDays .= \"\\t\\t<td colspan=\\\"\".$this->firstDayOfTheMonth.\"\\\" class=\\\"spacerDays\\\">&nbsp;</td>\\n\";\n\t\t\t$this->outArray['firstday'] = $this->firstDayOfTheMonth;\n\t\t}\n\t}", "function Footer()\n {\n $this->SetY(-12);\n $this->SetFont('Arial','B',5); \n $this->Cell(505,10,utf8_decode(\"TI. Fecha de creación: \").date(\"d-m-Y H:i\").\" \".\"Pag \".$this->PageNo(),0,0,'C'); \n }", "function Footer()\n {\n $this->SetY(-12);\n $this->SetFont('Arial','B',5); \n $this->Cell(505,10,utf8_decode(\"TI. Fecha de creación: \").date(\"d-m-Y H:i\").\" \".\"Pag \".$this->PageNo(),0,0,'C'); \n }", "function mkMonthFoot(){\nreturn \"</table>\\n\";\n}", "public function Footer(){\n $this->SetFont('Arial','',8);\n $date = new Date();\n $this->SetTextColor(100);\n $this->SetFillColor(245);\n $this->SetY(-10);\n $str = \"Elaborado Por Mercurio\";\n $x = $this->GetStringWidth($str);\n $this->Cell($x+10,5,$str,'T',0,'L');\n $this->Cell(0,5,'Pagina '.$this->PageNo().' de {nb}','T',1,'R');\n }", "function Footer(){\n $this->SetY(-12);\n\n $this->Cell(0,5,'Page '.$this->PageNo(),0,0,'L');\n $this->Cell(0,5,iconv( 'UTF-8','cp874','วันที่พิมพ์ :'.date('d').'/'.date('m').'/'.(date('Y')+543)),0,0,\"R\");\n}", "function FooterRR()\n {\n //Posición: a 2 cm del final\n $this->Ln();\n $this->SetY(-12);\n $this->SetFont('Arial','B',6);\n //Número de página\n $this->Cell(190,4,'Sistema de Control de Ventas y Facturacion \"BOUTIQUE DE ZAPATERIA\"','T',0,'L');\n $this->AliasNbPages();\n $this->Cell(0,4,'Pagina '.$this->PageNo(),'T',1,'R');\n }", "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}", "function Footer(){\n\t\t$this->Cell(190,0,'','T',1,'',true);\n\t\t\n\t\t//Go to 1.5 cm from bottom\n\t\t$this->SetY(-15);\n\t\t\t\t\n\t\t$this->SetFont('Arial','',8);\n\t\t\n\t\t//width = 0 means the cell is extended up to the right margin\n\t\t$this->Cell(0,10,'Page '.$this->PageNo().\" / {pages}\",0,0,'C');\n\t}", "function Footer() {\r\n $this->SetY(-15);\r\n // Set font\r\n $this->SetFont('Helvetica', 'I', 12);\r\n // Page number\r\n $this->Cell(0, 10, 'PvMax Summary | Schletter Inc. | (888) 608 - 0234', 0, false, 'C', 0, '', 0, false, 'T', 'M');\r\n}", "public function Footer(){\n // Posición: a 1,5 cm del final\n $this->SetY(-20);\n // Arial italic 8\n $this->AddFont('Futura-Medium');\n $this->SetFont('Futura-Medium','',10);\n $this->SetTextColor(50,50,50);\n // Número de págin\n $this->Cell(3);\n $this->Cell(0,3,utf8_decode('Generado por GetYourGames'),0,0,\"R\");\n $this->Ln(4);\n $this->Cell(3);\n $this->Cell(0,3,utf8_decode(date(\"d-m-Y g:i a\").' - Página ').$this->PageNo(),0,0,\"R\");\n\n }", "function Footer()\n{\n $this->SetY(-15);\n //Select Arial italic 8\n\t$this->Cell(0,10,' '.$this->PageNo(),0,0,'R');\n}", "function Footer()\n\t{\n\t $this->SetY(-15);\n\t //Arial italic 8\n\t $this->SetFont('Arial','I',7);\n\t //Page number\n\t $this->Cell(0,10,utf8_decode('PlatSource © '.date('Y')),0,0,'L');\n\t $this->Cell(0,10,utf8_decode('Página ').$this->PageNo().' de {nb}',0,0,'R');\n\t}", "function Footer()\n\t{\n\t $this->SetY(-15);\n\t //Arial italic 8\n\t $this->SetFont('Arial','I',7);\n\t //Page number\n\t $this->Cell(0,10,utf8_decode('Página ').$this->PageNo().' de {nb}',0,0,'R');\n\t}", "function Footer()\n\t{\n\t\t$this->SetY(-15);\n\t\t// Arial italic 8\n\t\t$this->SetFont('Arial','b',8);\n\t\t\n\t\t$this->Cell(30,1,\"----------------------------------------\",0,0,'C');\n\t\t$this->Cell(210,1,'',0,0);\n\t\t// $this->Cell(30,1,\"----------------------------------------\",0,0,'C');\n\t\t// $this->Cell(50,1,'',0,0);\n\t\t$this->Cell(30,1,\"----------------------------------------\",0,1,'C');\n\t\t\n\t\t$this->Cell(30,4,\"Prepared/Class Teacher\",0,0,'C');\n\t\t// $this->Cell(50,4,'',0,0);\n\t\t// $this->Cell(30,4,\"Controlar of Examination\",0,0,'C');\n\t\t$this->Cell(210,4,'',0,0);\n\t\t$this->Cell(30,4,\"Principal/VP\",0,1,'C');\n\t\t\n\t\t$this->Cell(50,4,date(\"d-m-y h:i:s A\"),0,0,'L');\n\t\t// Page number\n\t\t//$this->Cell(140,4,''.$this->PageNo().'/{nb}',0,0,'C');\n\t}", "function Footer()\r\n {\r\n $this->SetY(-15);\r\n //courier italic 8\r\n $this->SetFont('courier','I',8);\r\n //Page number\r\n $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');\r\n $this->SetX(5);\r\n $this->SetFont('courier','I',6);\r\n\r\n $this->Cell(0,10,'Tanggal Cetak : '.date(\"d/m/Y\"),0,0,'L');\r\n $this->SetY($this->GetY()+3);\r\n $this->Cell(0,10,'Cetak Oleh : '.$this->printby,0,0,'L');\r\n }", "function Footer()\n {\n $this->SetY(-15);\n // Arial italic 8\n $this->SetFont('Arial','I',8);\n // Page number\n $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');\n }", "function Footer()\t{\n\t $this->SetY(-15);\n\t // Arial italic 8\n\t $this->SetFont('Arial','I',8);\n\t // Page number\n\t $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');\n\t}", "function Footer()\n\t{\n\t\t$this->SetY(-15);\n\t\t//buat garis horizontal\n\t\t$this->Line(30,$this->GetY(),185,$this->GetY());\n\t\t//Arial italic 9\n\t\t$this->SetFont('Arial','I',9);\n\t\t//nomor halaman\n\t\t$this->Cell(0,10,'Halaman '.$this->PageNo().' dari {nb}',0,0,'R');\n\t}", "function Footer(){\n $this->SetY(-15);\n // Arial italic 8\n $this->SetFont('Arial','I',8);\n // Page number\n $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');\n }", "function Footer(){\n ($this->kriteria=='neraca')?$this->SetY(-10):$this->SetY(-15);\n //Arial italic 8\n $this->SetFont('Arial','i',7);\n if($this->kriteria=='faktur'){\n $this->Cell(150,10,'Berlaku sebagai faktur pajak sesuai Peraturan Menkeu No. 38/PMK.03/2010',0,0,'L');\n }else{\n $this->Cell(0,10,'Print Date :'.date('d F Y'),0,0,'C');\n }\n $this->Cell(0,10,'Page '.$this->PageNo().' of {nb}',0,0,'R');\n}", "public function Footer() {\n\t\t$this->SetY(-15);\n\t\t// Set font\n\t\t$this->SetFont('helvetica', 'I', 8);\n\t\t// Page number\n\t\t$this->Cell(0, 10, 'Pagina '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');\n\t}", "function Footer() {\n $this->SetY(-15);\n // Select Arial italic 8\n $this->SetFont('Arial', 'B', 8);\n // Print centered page number\n $this->Cell(0, 5, utf8_decode(\"[Página \") . $this->PageNo() . \"]\", 0, 0, 'L');\n }", "function Footer() {\n $this->SetY(-15);\n // Select Arial italic 8\n $this->SetFont('Arial', 'B', 8);\n // Print centered page number\n $this->Cell(0, 5, utf8_decode(\"[Página \") . $this->PageNo() . \"]\", 0, 0, 'L');\n }", "function Footer()\n {\n $this->SetY(-11);\n $this->Cell(45);\n // Select Arial italic 8\n $this->SetFont('Arial','I',8);\n // Print centered page number\n $this->Cell(6,10,'',0,0,'C');\n $this->Cell(96,10,'Nombre y Firma','T',0,'C');\n $this->Cell(0,10,utf8_decode('Página ').$this->PageNo(),0,0,'R');\n\n }", "function Footer() {\n $this->SetY(-15);\n // Select Arial italic 8\n $this->SetFont('Arial','I',8);\n // Print centered page number\n // $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');\n $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');\n }", "public function Footer()\n {\n $this->SetFont('Arial', 'I', 8);\n $this->SetY(-15);\n $this->Write(4, 'Dokumen ini dicetak secara otomatis menggunakan sistem terkomputerisasi');\n\n $time = \"Dicetak pada tanggal \" . date('d-m-Y H:i:s') . \" WIB\";\n\n $this->SetX(-150);\n $this->Cell(0, 4, $time, 0, 0, 'R');\n }", "function Footer()\n {\n date_default_timezone_set('UTC+1');\n //Date\n $tDate = date('F j, Y, g:i:s a');\n // Position at 1.5 cm from bottom\n $this->SetY(-15);\n // Arial italic 8\n $this->SetFont('Arial', 'I', 12);\n // Text color in gray\n $this->SetTextColor(128);\n // Page number\n $this->Cell(0, 10,utf8_decode('Page ' . $this->PageNo().' \n CHUYC \n '.$tDate.'\n +237 693 553 454\n '.$this->Image(SITELOGO, 189, 280, 10, 10,'', URLROOT)), 0, 0, 'L');\n }", "function Footer()\n\t{\n\t\t$this->SetY(-15);\n\t\t// Select Arial italic B\n\t\t$this->setfont('Arial','I',14);\n\t\t$this->cell(250,8,\"Proyecto Final, copyright &copy; 2019\",0,0,'c');\n\t\t// Print centered page numbre\n\t\t$this->Cell(0,10,'Pag.'.$this->PageNo(),0,0,'c');\n\t}", "public function Footer(){\n // Position at 15 mm from bottom\n $this->SetY(-15);\n // Set font\n\t\t$html = \"<table>\";\n\t\t$html .= \"<tr><td>unidad de adm y serv</td><td>responsable del proyecto o accion centralizada</td><td>unidad de finanzas</td><td>unidad de planificacion ppto</td><td>presidente</td><td>secreatria de adcripcion</td><td>Secretaria de Planificacion presupuesto y control de gestion</td><td>Gobernador del estado</td></tr>\";\n\t\t$html .= \"<tr><td>.</td><td>.</td><td>.</td><td>.</td><td>.</td><td>.</td><td>.</td><td>.</td></tr>\";\n\t\t$html .= \"</table>\";\n\t\t$this->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);\n $this->SetFont('helvetica', 'I', 8);\n // Page number\n $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');\n }" ]
[ "0.66103333", "0.5805584", "0.5805584", "0.58004963", "0.5792688", "0.5748435", "0.5729793", "0.5726929", "0.57091856", "0.55485076", "0.54882425", "0.5455331", "0.54490894", "0.5418281", "0.54126287", "0.5407858", "0.53825533", "0.5380916", "0.53771776", "0.53756195", "0.53728837", "0.5372667", "0.5362468", "0.5362468", "0.5359196", "0.53557044", "0.53363115", "0.533513", "0.53298897", "0.5325255" ]
0.78970635
0
Create a listing of events for HTML display Creates a listing of events occuring on the given day as items. These items are added into the cell of the calendar for the given day.
private function makeDayEventListHTML() { $showtext = ""; foreach($this->eventItems as $item) { if($item['date'] == $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth) { $category = (strlen($item['cat']) > 0 ? 'Category: '.$item['cat'].' - ' : ''); $outevents[$n]['category'] = $item['cat']; if($item['stdurl']) { $href = '<a href="'.$item['url'].'?id='.$item['id'].'" title="'.$category.$item['desc'].'">'.$item['text'].'</a>'; $outevents[$n]['url'] = $item['url'].'?id='.$item['id']; } else { $href = (strlen($item['url']) > 0 ? '<a href="'.$item['url'].'" title="'.$category.$item['desc'].'">'.$item['text'].'</a>' : $item['text']); $outevents[$n]['url'] = $item['url']; } $style = (strlen($item['catcolor']) > 0 ? ' style="background-color:#'.str_replace('#','',$item['catcolor']).';" ' : ' style="background-color:#eeeeee;" '); $showtext .= "\n\t\t\t<div class=\"dayContent\"".$style.">".$href."</div>\n\t\t"; $outevents[$n]['summary'] = $item['text']; $outevents[$n]['description'] = $item['desc']; $outevents[$n]['categorycolor'] = (strlen($item['catcolor']) > 0 ? str_replace('#','',$item['catcolor']) : '#eeeeee'); } $n++; } return $showtext; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function makeHTMLIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$style = 'class=\"normalDay\"';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$style = 'class=\"weekendDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$style = 'class=\"currentDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->calWeekDays .= \"\\t</tr>\\n\\t<tr>\\n\";\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t}\n\n\t\t\t// Draw days\n\t\t\t$this->calWeekDays .= \"\\t\\t<td valign=\\\"top\\\" \".$style.'>'.$this->dayOfMonth;\n\t\t\t\n\t\t\tif($this->addWeekDay) {\n\t\t\t\t$this->calWeekDays .= \"|\".$this->weekDayNum;\n\t\t\t}\n\t\t\t\n\t\t\tif(strlen($this->addEvtDest) > 0) {\n\t\t\t\t$addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src=\"'.$this->addEvtImg.'\" class=\"addevtimg\" />' : '+');\n\t\t\t\t$this->calWeekDays .= '[<a href=\"'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'\" title=\"Add Event\" class=\"addevt\">'.$addevtimg.'</a>]';\n\t\t\t}\n\t\t\t\n\t\t\t$this->calWeekDays .= \" \".$this->makeDayEventListHTML().\"</td>\\n\";\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "function display_day()\n{\n global $phpcid, $phpc_cal, $phpc_script, $phpcdb, $day, $month, $year;\n\n\t$monthname = month_name($month);\n\n $results = $phpcdb->get_occurrences_by_date($phpcid, $year, $month, $day);\n\n\t$have_events = false;\n\n\t$html_table = tag('table', attributes('class=\"phpc-main\"'),\n\t\t\ttag('caption', \"$day $monthname $year\"),\n\t\t\ttag('thead',\n\t\t\t\ttag('tr',\n\t\t\t\t\ttag('th', __('Title')),\n\t\t\t\t\ttag('th', __('Time')),\n\t\t\t\t\ttag('th', __('Description'))\n\t\t\t\t )));\n\tif($phpc_cal->can_modify()) {\n\t\t$html_table->add(tag('tfoot',\n\t\t\t\t\ttag('tr',\n\t\t\t\t\t\ttag('td',\n\t\t\t\t\t\t\tattributes('colspan=\"4\"'),\n\t\t\t\t\t\t\tcreate_hidden('action', 'event_delete'),\n\t\t\t\t\t\t\tcreate_hidden('day', $day),\n\t\t\t\t\t\t\tcreate_hidden('month', $month),\n\t\t\t\t\t\t\tcreate_hidden('year', $year),\n\t\t\t\t\t\t\tcreate_submit(__('Delete Selected'))))));\n\t}\n\n\t$html_body = tag('tbody');\n\n\twhile($row = $results->fetch_assoc()) {\n\t\n\t\t$event = new PhpcOccurrence($row);\n\n\t\tif(!$event->can_read())\n\t\t\tcontinue;\n\n\t\t$have_events = true;\n\n\t\t$eid = $event->get_eid();\n\t\t$oid = $event->get_oid();\n\n\t\t$html_subject = tag('td');\n\n\t\tif($event->can_modify()) {\n\t\t\t$html_subject->add(create_checkbox('eid[]',\n\t\t\t\t\t\t$eid));\n\t\t}\n\n\t\t$html_subject->add(create_occurrence_link(tag('strong',\n\t\t\t\t\t\t$event->get_subject()),\n\t\t\t\t\t'display_event', $oid));\n\n\t\tif($event->can_modify()) {\n\t\t\t$html_subject->add(\" (\");\n\t\t\t$html_subject->add(create_event_link(\n\t\t\t\t\t\t__('Modify'), 'event_form',\n\t\t\t\t\t\t$eid));\n\t\t\t$html_subject->add(')');\n\t\t}\n\n\t\t$html_body->add(tag('tr',\n\t\t\t\t\t$html_subject,\n\t\t\t\t\ttag('td', $event->get_time_span_string()),\n\t\t\t\t\ttag('td', attributes('class=\"phpc-desc\"'), $event->get_desc())));\n\t}\n\n\t$html_table->add($html_body);\n\n\tif($phpc_cal->can_modify()) {\n\t\t$output = tag('form',\n\t\t\t\tattributes(\"action=\\\"$phpc_script\\\"\"),\n\t\t\t\t$html_table);\n\t} else {\n\t\t$output = $html_table;\n\t}\n\n\tif(!$have_events)\n\t\t$output = tag('h2', __('No events on this day.'));\n\n\treturn tag('', create_day_menu(), $output);\n}", "public function buildDayList($date){\n\t\t$events = $this->getDayEvents($date);\n\t\t$count = 0;\n\t\t\n\t\tob_start();\n\t\tif(count($events) > 0){\n\t\t\tforeach($events as $key => $event){\t\t\t\n\t\t\t\t$recurringDays = $event->getRecurringDays();\n\t\t\t\t\t\t\n\t\t\t\t$dayOfWeek = date_create($date);\n\t\t\t\t$dayOfWeek = strtolower(date_format($dayOfWeek, \"l\"));\n\t\t\t\t//echo $dayOfWeek;\n\n\t\t\t\tif(count($recurringDays)){\n\t\t\t\t\tif(in_array($dayOfWeek, $recurringDays)){\n\t\t\t\t\t\techo '<h4>Events for ' . $this->getDate($date) . '</h4>';\n\t\t\t\t\t\techo $event->toHtml('listing');\n\t\t\t\t\t\techo '<hr />';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\techo '<h4>Events for ' . $this->getDate($date) . '</h4>';\n\t\t\t\t\techo $event->toHtml('listing');\n\t\t\t\t\techo '<hr />';\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t$count++;\n\t\t\t}\n\t\t}\n\t\treturn ob_get_clean();\n\t}", "public function buildCalendarList(){\n\t\t\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'list';\n\t\t\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\" class=\"calendar_list\">\n <?php echo $this->buildCalendarHead() ?>\n <tr>\n <td>\n <?php \n /*** CURRENT MONTH CELLS ***/\n $first_day = $this->getYear() . '-' . $this->getMonth() . '-01';\n $last_day = $this->getYear() . '-' . $this->getMonth() . '-' . $current_number_of_days;\n \n $object = $this->events_ob;\n $month_events = new $object();\n $month_events = $month_events->fetchAll(\"WHERE DATE(\" . $this->events_end_date_field . \") >= '\" . $first_day . \"' AND DATE(\" . $this->events_end_date_field . \") <= '\" . $last_day . \"'\", \"ORDER BY `\" . $this->events_end_date_field . \"` DESC\");\n \n if(count($month_events) > 0){\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n \n $events = $this->buildDayList($full_date);\t//get events for each day\n if(strlen(trim($events))){\n ?>\n <div class=\"day\">\n <?php echo $events; ?>\n </div>\n <?php\n }\n }\n }\n else{?>\n \t\t<h5><?php echo 'No events in ' . $this->getMonthName() . ' ' . $this->getYear();?></h5>\n <?php\n }\n ?> \n </td>\n </tr>\n </table>\n <?php\n return ob_get_clean();\n\t}", "public static function day_calendar_item($event, $class) {\r\n global $urlServer, $is_admin, $langDuration, $langAgendaNoTitle, $langModify, $langDelete, $langHour, $langConfirmDelete, $langReferencedObject;\r\n\r\n $formatted_calendar_item = \"\";\r\n $formatted_calendar_item .= \"<tr $class>\";\r\n $formatted_calendar_item .= \"<td valign='top'><div class=\\\"legend_color\\\" style=\\\"float:left;margin:3px;height:16px;width:16px;background-color:\".Calendar_Events::$calsettings->{$event->event_group.\"_color\"}.\"\\\"></div></td>\";\r\n $formatted_calendar_item .= \"<td valign='top'>\";\r\n $eventdate = strtotime($event->start);\r\n $formatted_calendar_item .= $langHour.\": \" . ucfirst(date('H:i', $eventdate));\r\n if ($event->duration != '') {\r\n $msg = \"($langDuration: \" . q($event->duration) . \")\";\r\n } else {\r\n $msg = '';\r\n }\r\n $formatted_calendar_item .= \"<br><b><div class='event'>\";\r\n $link = str_replace('thisid', $event->id, $urlServer.Calendar_Events::$event_type_url[$event->event_type]);\r\n if ($event->event_type != 'personal' && $event->event_type != 'admin') {\r\n $link = str_replace('thiscourse', $event->course, $link);\r\n }\r\n if ($event->title == '') {\r\n $formatted_calendar_item .= $langAgendaNoTitle;\r\n } else {\r\n if (!$is_admin && $event->event_type == 'admin') {\r\n $formatted_calendar_item .= q($event->title);\r\n } else {\r\n $formatted_calendar_item .= \"<a href=\\\"\".$link.\"\\\">\".q($event->title).\"</a>\";\r\n }\r\n }\r\n if ($event->event_type == \"personal\") {\r\n $fullevent = Calendar_Events::get_event($event->id);\r\n if ($reflink = References::item_link($fullevent->reference_obj_module, $fullevent->reference_obj_type, $fullevent->reference_obj_id, $fullevent->reference_obj_course)) {\r\n $formatted_calendar_item .= \"</b> $msg \".standard_text_escape($event->content)\r\n . \"$langReferencedObject: \"\r\n .$reflink\r\n . \"</div></td>\";\r\n }\r\n }\r\n else{\r\n $formatted_calendar_item .= \"</b> $msg \".standard_text_escape($event->content). \"</div></td>\";\r\n }\r\n $formatted_calendar_item .= \"<td class='right' width='70'>\";\r\n if ($event->event_type == \"personal\" || ($event->event_type == \"admin\" && $is_admin)) {\r\n $formatted_calendar_item .= icon('fa-edit', $langModify, str_replace('thisid',$event->id,Calendar_Events::$event_type_url[$event->event_type])). \"&nbsp;\r\n \".icon('fa-times', $langDelete, \"?delete=$event->id&et=$event->event_type\", \"onClick=\\\"return confirmation('$langConfirmDelete');\\\"\"). \"&nbsp;\";\r\n }\r\n $formatted_calendar_item .= \"</td>\";\r\n $formatted_calendar_item .= \"</tr>\";\r\n\r\n return $formatted_calendar_item;\r\n }", "function obj_do_cx_events_list( $events ) {\n\tif (is_array($events) ) {\n echo '<div class=\"event-list-grid\">';\n foreach ($events as $event ) {\n obj_do_cx_event_item_output($event);\n }\n echo '</div>';\n }\n}", "public static function index($day)\n {\n $todo = ORM::for_table('todo')\n ->where_raw(\"`completed` IS NULL\")\n ->order_by_asc('order')\n ->find_many();\n \n $tasklist = '';\n foreach ($todo as $task) {\n $task->age = self::age($task);\n set('task', $task);\n $tasklist .= partial('snippets/todo.html.php'); \n }\n \n return partial(\"todolist.html.php\", array('tasklist' => $tasklist));\n }", "private function add_events()\r\n {\r\n $events = $this->events;\r\n foreach ($events as $time => $items)\r\n {\r\n $column = date('H', $time) / $this->hour_step + 1;\r\n foreach ($items as $item)\r\n {\r\n $content = $item['content'];\r\n $row = $item['index'] + 1;\r\n \r\n $cell_content = $this->getCellContents($row, $column);\r\n $cell_content .= $content;\r\n $this->setCellContents($row, $column, $cell_content);\r\n }\r\n }\r\n \r\n }", "function render_list($events,$detail_flag){\n\t\t$number_of_events=sizeof($events);\n\t\t$i=0;\n\t\t$return_val=\"\";\n\n\t\t$return_val=$return_val.\"<table>\";\n\t\twhile($i<$number_of_events){\n\t\t\t$next_event=$events[$i];\n\n\t\t\t$return_val=$return_val.'<tr><td class=\"eventText\">';\n\n\t\t\tif ($detail_flag==\"off\") {\n\t\t\t\t$return_val=$return_val.\"<b>\";\n\t\t\t}\n\t\t\t$return_val=$return_val.\"(\".($i+1).\")&nbsp;&nbsp;\";\n\t\t\tif ($detail_flag==\"on\") {\n\t\t\t\t$return_val=$return_val.\"<a href=\\\"#\".($i+1).\"\\\">\";\n\t\t\t}\n\t\t\t$return_val=$return_val.(htmlspecialchars($next_event->get_title()));\n\t\t\tif ($detail_flag==\"off\") {\n\t\t\t\t$return_val=$return_val.\"</b>\";\n\t\t\t}\n\n\t\t\tif ($detail_flag==\"on\") {\n\t\t\t\t$return_val=$return_val.\"</a>\";\n\t\t\t}\n\n\t\t\t$return_val=$return_val.'<br />';\n\t\t\t$date=$next_event->get_start_date_object();\n\t\t\t$return_val=$return_val.date(\"D\", $date->timestamp).\"&nbsp;\";\n\t\t\t$return_val=$return_val.date(\"M\", $date->timestamp).\".&nbsp;\";\n\t\t\t$return_val=$return_val.$next_event->get_start_day().\",&nbsp;\";\n\n\t\t\t$start_time_obj=$next_event->get_start_time_object();\n\t\t\t$display_timerange=$start_time_obj->get_display_time();\n\t\t\tif ($next_event->get_duration()>0){\n\t\t\t\t$end_time_obj=$next_event->get_end_time_object();\n\t\t\t\t$display_timerange=$display_timerange.\" - \".$end_time_obj->get_display_time();\n\t\t\t}\n\n\t\t\t$return_val=$return_val.$display_timerange.\"&nbsp;-&nbsp;\";\n\t\t\tif (strlen(trim($next_event->get_location_name()))>0){\n\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_location_name()).\"&nbsp;\";\n\t\t\t}\n\n\t\t\t$return_val=$return_val.'<br />';\n\t\t\t$return_val=$return_val.'Event Topic:&nbsp;&nbsp;'.(htmlspecialchars($next_event->get_event_topic_name()));\n\n\t\t\t$return_val=$return_val.'<br />';\n\t\t\t$return_val=$return_val.'Event Type:&nbsp;&nbsp;'.(htmlspecialchars($next_event->get_event_type_name()));\n\n\t\t\t$return_val=$return_val.\"</td></tr>\";\n\t\t\t$i=$i+1;\n\t\t}\n\n\t\tif ($detail_flag==\"on\") {\n\n\t\t\tif ($number_of_events >0)\n\t\t\t\t$return_val=$return_val.\"<tr><td>---------------------------------------------------</td></tr>\";\n\t\t\t$i=0;\n\n\t\t\twhile($i<$number_of_events){\n\t\t\t\t$next_event=$events[$i];\n\n\t\t\t\t$return_val=$return_val.'<tr><td class=\"eventText\"><b>';\n\t\t\t\t$return_val=$return_val.'<a name=\"'.($i+1).'\"></a>';\n\t\t\t\t$return_val=$return_val.\"(\".($i+1).\")&nbsp;&nbsp;\";\n\t\t\t\t$return_val=$return_val.(htmlspecialchars($next_event->get_title()));\n\t\t\t\t$return_val=$return_val.\"</b></td></tr>\";\n\n\t\t\t\t$return_val=$return_val.'<tr><td class=\"eventText\">';\n\t\t\t\t$date=$next_event->get_start_date_object();\n\n\t\t\t\t$return_val=$return_val.date(\"D\", $date->timestamp).\"&nbsp;\";\n\t\t\t\t$return_val=$return_val.date(\"M\", $date->timestamp).\".&nbsp;\";\n\t\t\t\t$return_val=$return_val.$next_event->get_start_day().\",&nbsp;\";\n\n\t\t\t\t$start_time_obj=$next_event->get_start_time_object();\n\t\t\t\t$display_timerange=$start_time_obj->get_display_time();\n\t\t\t\tif ($next_event->get_duration()>0){\n\t\t\t\t\t$end_time_obj=$next_event->get_end_time_object();\n\t\t\t\t\t$display_timerange=$display_timerange.\" - \".$end_time_obj->get_display_time();\n\t\t\t\t}\n\n\t\t\t\t$return_val=$return_val.$display_timerange;\n\t\t\t\t$return_val=$return_val.'<br />';\n\n\t\t\t\tif (strlen(trim($next_event->get_location_name()))>0){\n\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_location_name()).\"&nbsp;\";\n\t\t\t\t}\n\n\t\t\t\t$return_val=$return_val.'<br />';\n\n\t\t\t\t$return_val=$return_val.(htmlspecialchars($next_event->get_location_details()));\n\t\t\t\t$return_val=$return_val.'</td></tr>';\n\n\t\t\t\t$return_val=$return_val.'<tr><td class=\"eventText\">';\n\t\t\t\t$return_val=$return_val.\"Contact:<br />\";\n\n\t\t\t\tif (strlen(trim($next_event->get_contact_name()))>0){\n\t\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_contact_name()).\"<br />\";\n\t\t\t\t}\n\t\t\t\tif (strlen(trim($next_event->get_contact_phone()))>0){\n\t\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_contact_phone()).\"<br />\";\n\t\t\t\t}\n\t\t\t\tif (strlen(trim($next_event->get_contact_email()))>0){\n\t\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_contact_email()).\"<br />\";\n\t\t\t\t}\n\n\t\t\t\t$return_val=$return_val.'</td><tr>';\n\n\t\t\t\t$return_val=$return_val.'<tr><td>&nbsp;</td></tr>';\n\n\t\t\t\t$return_val=$return_val.'<tr><td class=\"eventText\">';\n\t\t\t\t$return_val=$return_val.(nl2br($next_event->get_description()));\n\t\t\t\t$return_val=$return_val.'</td></tr>';\n\n\t\t\t\t$return_val=$return_val.\"<tr><td>&nbsp;</td></tr>\";\n\t\t\t\t$i=$i+1;\n\t\t\t}\n\t\t}\n\n\t\t$return_val=$return_val.'</table>';\n\n\t\tif (strlen($return_val)==0){\n\t\t\treturn \"&nbsp;\";\n\t\t}\n\t\treturn $return_val;\n\t}", "function DisplayCalendarOfEvents()\r\n\t{\r\n\t\tglobal $_SETTINGS;\r\n\t\techo \"<div id='calendar'></div>\";\t\r\n\t}", "function displayLatestEvents()\n\t{\n\t\t$viewname = $this->getTheme();\n\n\t\t$cfg = JEVConfig::getInstance();\n\n\t\t// override global start now setting so that timelimit plugin can use it!\n\t\t$compparams = ComponentHelper::getParams(JEV_COM_COMPONENT);\n\t\t$startnow = $compparams->get(\"startnow\", 0);\n\t\t$compparams->set(\"startnow\", $this->modparams->get(\"startnow\", 0));\n\t\t$this->getLatestEventsData();\n\t\t$compparams->set(\"startnow\", $startnow);\n\n\t\t$content = \"\";\n\n\t\t$k = 0;\n\t\tif (isset($this->eventsByRelDay) && count($this->eventsByRelDay))\n\t\t{\n\t\t\t$content .= $this->getModuleHeader('<table class=\"mod_events_latest_table jevbootstrap\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">');\n\n\t\t\t// Now to display these events, we just start at the smallest index of the $this->eventsByRelDay array\n\t\t\t// and work our way up.\n\n\t\t\t$firstTime = true;\n\n\t\t\t// initialize name of com_jevents module and task defined to view\n\t\t\t// event detail. Note that these could change in future com_event\n\t\t\t// component revisions!! Note that the '$this->itemId' can be left out in\n\t\t\t// the link parameters for event details below since the event.php\n\t\t\t// component handler will fetch its own id from the db menu table\n\t\t\t// anyways as far as I understand it.\n\n\t\t\t$this->processFormatString();\n\n\t\t\tforeach ($this->eventsByRelDay as $relDay => $daysEvents)\n\t\t\t{\n\n\t\t\t\treset($daysEvents);\n\n\t\t\t\t// get all of the events for this day\n\t\t\t\tforeach ($daysEvents as $dayEvent)\n\t\t\t\t{\n\n\t\t\t\t\tif ($this->processTemplate($content, $dayEvent))\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\t$eventcontent = \"\";\n\n\t\t\t\t\t// generate output according custom string\n\t\t\t\t\tforeach ($this->splitCustomFormat as $condtoken)\n\t\t\t\t\t{\n\n\t\t\t\t\t\tif (isset($condtoken['cond']))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($condtoken['cond'] == 'a' && !$dayEvent->alldayevent())\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\telse if ($condtoken['cond'] == '!a' && $dayEvent->alldayevent())\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\telse if ($condtoken['cond'] == 'e' && !($dayEvent->noendtime() || $dayEvent->alldayevent()))\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\telse if ($condtoken['cond'] == '!e' && ($dayEvent->noendtime() || $dayEvent->alldayevent()))\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\telse if ($condtoken['cond'] == '!m' && $dayEvent->getUnixStartDate() != $dayEvent->getUnixEndDate())\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\telse if ($condtoken['cond'] == 'm' && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate())\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforeach ($condtoken['data'] as $token)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($match);\n\t\t\t\t\t\t\tunset($dateParm);\n\t\t\t\t\t\t\t$dateParm = \"\";\n\t\t\t\t\t\t\t$match = '';\n\t\t\t\t\t\t\tif (is_array($token))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$match = $token['keyword'];\n\t\t\t\t\t\t\t\t$dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : \"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (strpos($token, '${') !== false)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$match = $token;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$eventcontent .= $token;\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->processMatch($eventcontent, $match, $dayEvent, $dateParm, $relDay);\n\t\t\t\t\t\t} // end of foreach\n\t\t\t\t\t} // end of foreach\n\n\t\t\t\t\tif ($firstTime)\n\t\t\t\t\t\t$eventrow = '<tr class=\"jevrow' . $k . '\"><td class=\"mod_events_latest_first\">%s' . \"</td></tr>\\n\";\n\t\t\t\t\telse\n\t\t\t\t\t\t$eventrow = '<tr class=\"jevrow' . $k . '\"><td class=\"mod_events_latest\">%s' . \"</td></tr>\\n\";\n\n\t\t\t\t\t$templaterow = $this->modparams->get(\"modlatest_templaterow\") ? $this->modparams->get(\"modlatest_templaterow\") : $eventrow;\n\t\t\t\t\t$content .= str_replace(\"%s\", $eventcontent, $templaterow);\n\n\t\t\t\t\t$firstTime = false;\n\t\t\t\t} // end of foreach\n\t\t\t\t$k++;\n\t\t\t\t$k %= 2;\n\t\t\t} // end of foreach\n\t\t\t$content .= $this->getModuleFooter(\"</table>\\n\");\n\t\t}\n\t\telse if ($this->modparams->get(\"modlatest_NoEvents\", 1))\n\t\t{\n\t\t\t$content .= $this->modparams->get(\"modlatest_templatetop\") || $this->modparams->get(\"modlatest_templatetop\") ? $this->modparams->get(\"modlatest_templatetop\") : '<table class=\"mod_events_latest_table jevbootstrap\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">';\n\t\t\t$templaterow = $this->modparams->get(\"modlatest_templaterow\") ? $this->modparams->get(\"modlatest_templaterow\") : '<tr><td class=\"mod_events_latest_noevents\">%s</td></tr>' . \"\\n\";\n\t\t\t$content .= str_replace(\"%s\", Text::_('JEV_NO_EVENTS'), $templaterow);\n\t\t\t$content .= $this->modparams->get(\"modlatest_templatebottom\") ? $this->modparams->get(\"modlatest_templatebottom\") : \"</table>\\n\";\n\t\t}\n\n\t\t$callink_HTML = '<div class=\"mod_events_latest_callink\">'\n\t\t\t. $this->getCalendarLink()\n\t\t\t. '</div>';\n\n\t\tif ($this->linkToCal == 1)\n\t\t\t$content = $callink_HTML . $content;\n\t\tif ($this->linkToCal == 2)\n\t\t\t$content .= $callink_HTML;\n\n\t\tif ($this->displayRSS)\n\t\t{\n\t\t\t$rssimg = Uri::root() . \"media/system/images/livemarks.png\";\n\t\t\t$callink_HTML = '<div class=\"mod_events_latest_rsslink\">'\n\t\t\t\t. '<a href=\"' . $this->rsslink . '\" title=\"' . Text::_(\"RSS_FEED\") . '\" target=\"_blank\">'\n\t\t\t\t. '<img src=\"' . $rssimg . '\" alt=\"' . Text::_(\"RSS_FEED\") . '\" />'\n\t\t\t\t. Text::_(\"SUBSCRIBE_TO_RSS_FEED\")\n\t\t\t\t. '</a>'\n\t\t\t\t. '</div>';\n\t\t\t$content .= $callink_HTML;\n\t\t}\n\n\t\tif ($this->modparams->get(\"contentplugins\", 0))\n\t\t{\n\t\t\t$eventdata = new stdClass();\n\t\t\t$eventdata->text = $content;\n\t\t\tFactory::getApplication()->triggerEvent('onContentPrepare', array('com_jevents', &$eventdata, &$this->modparams, 0));\n\t\t\t$content = $eventdata->text;\n\t\t}\n\n\t\treturn $content;\n\n\t}", "private function buildBodyDay()\n {\n\n $events = $this->events;\n $h = \"\";\n for ($i = $this->start_hour; $i < $this->end_hour; $i++) {\n for ($t = 0; $t < 2; $t++) {\n $h .= \"<tr>\";\n $min = $t == 0 ? \":00\" : \":30\";\n $h .= \"<td class='$this->timeClass'>\" . date('g:ia', strtotime($i . $min)) . \"</td>\";\n for ($k = 0; $k < 1; $k++) {\n $wd = $this->week_days[$k];\n $time_r = $this->year . '-' . $this->month . '-' . $wd . ' ' . $i . ':00:00';\n $min = $t == 0 ? '' : '+30 minute';\n $time_1 = strtotime($time_r . $min);\n $time_2 = strtotime(date('Y-m-d H:i:s', $time_1) . '+30 minute');\n $dt = date('Y-m-d H:i:s', $time_1);\n $h .= \"<td colspan='3' data-datetime='$dt'>\";\n $h .= $this->dateWrap[0];\n\n $hasEvent = false;\n foreach ($events as $key => $event) {\n //EVENT TIME AND DATE\n $time_e = strtotime($key);\n if ($time_e >= $time_1 && $time_e < $time_2) {\n $hasEvent = true;\n $h .= $this->buildEvents(false, $event);\n }\n }\n $h .= !$hasEvent ? '&nbsp;' : '';\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n $h .= \"</tr>\";\n }\n }\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n\n $this->html .= $h;\n }", "function getEvents($date = '') {\n include 'config.php';\n $eventListHTML = '';\n $date = $date ? $date : date(\"Y-m-d\");\n //Get events based on the current date\n $result = $con->query(\"SELECT * FROM med_records WHERE entry_date = '\" . $date . \"' \");\n if ($result->num_rows > 0) {\n $eventListHTML = '<h2>Events on ' . date(\"l, d M Y\", strtotime($date)) . '</h2>';\n $eventListHTML .= '<td>';\n while ($row = $result->fetch_assoc()) {\n $eventListHTML .= '<td>' . $row['emp_name'] . '</td>';\n }\n $eventListHTML .= '</td>';\n }\n echo $eventListHTML;\n}", "public function eventsAction()\n {\n $events = $this->manager->getRepository('Event\\Doctrine\\Orm\\Event')->findBy(array(), array('date' => 'ASC'));\n\n return $this->renderView('events', array(\n 'title' => 'Zusammenfassung der Grillveranstaltungen',\n 'events' => $events,\n 'meals' => $this->createMealsList($events),\n ));\n }", "function getEvents($date = '') {\r\n //Include db configuration file\r\n include 'dbConfig.php';\r\n $eventListHTML = '';\r\n $date = $date ? $date : date(\"Y-m-d\");\r\n //Get events based on the current date\r\n $result = $db->query(\"SELECT title FROM floralbookings WHERE date = '\" . $date . \"' AND status = 1\");\r\n if ($result->num_rows > 0) {\r\n $eventListHTML = '<h2>Events on ' . date(\"l, d M Y\", strtotime($date)) . '</h2>';\r\n $eventListHTML .= '<ul>';\r\n while ($row = $result->fetch_assoc()) {\r\n $eventListHTML .= '<li>' . $row['title'] . '</li>';\r\n }\r\n $eventListHTML .= '</ul>';\r\n }\r\n echo $eventListHTML;\r\n}", "function display_list(){\n\t\t\t$this->load->model('admin_career_event_model');\n\t\t\t$this->gen_contents['modal_path'] \t= '/career_event/class_details';\n\t\t\t$this->gen_contents['current_date']\t= $_POST['datecurrent'];\n \n $chp_list = $this->config->item('chapter_list');\n\t\t\t$this->gen_contents['arr_list'] \t= $this->admin_career_event_model->dbGetEventListWithSearchUser($_POST,$chp_list);\n\t\t\t$this->load->view('user/career_event/display_list_event',$this->gen_contents);\n\t\t}", "public function dayList()\n\t{\n\t\techo json_encode($this->sched_day->fetchData());\n\t}", "function showEvents() {\r\n\r\n\t// Lets import some globals, shall we?\r\n\tglobal $MySelf;\r\n\tglobal $DB;\r\n\tglobal $TIMEMARK;\r\n\t$delta = $TIMEMARK -259200;\r\n\t\r\n\t// is the events module active?\r\n\tif (!getConfig(\"events\")) {\r\n\t\tmakeNotice(\"The admin has deactivated the events module.\", \"warning\", \"Module not active\");\r\n\t}\r\n\r\n\t// Load all events.\r\n\t$EVENTS_DS = $DB->query(\"SELECT * FROM events WHERE starttime >= '\" . $delta . \"' ORDER BY starttime ASC\");\r\n\r\n\t// .. right?\r\n\tif ($EVENTS_DS->numRows() >= 1) {\r\n\r\n\t\t// Lets keep in mind: We have events.\r\n\t\t$haveEvents = true;\r\n\r\n\t\twhile ($event = $EVENTS_DS->fetchRow()) {\r\n\r\n\t\t\t// get the date.\r\n\t\t\t$date = date(\"d.m.y\", $event[starttime]);\r\n\r\n\t\t\t// open up a new table for each day.\r\n\t\t\tif ($date != $previousdate) {\r\n\r\n\t\t\t\t$workday = date(\"l\", $event[starttime]);\r\n\r\n\t\t\t\tif ($beenhere) {\r\n\t\t\t\t\t$html .= $temp->flush();\r\n\t\t\t\t\t$html .= \"<br>\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$beenhere = true;\r\n\r\n\t\t\t\t// We need an additional row if we are allowed to delete events.\r\n\t\t\t\tif ($MySelf->canDeleteEvents()) {\r\n\t\t\t\t\t$temp = new table(8, true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$temp = new table(7, true);\r\n\t\t\t\t}\r\n\t\t\t\t$temp->addHeader(\">> Events for \" . $workday . \", the \" . $date);\r\n\t\t\t\t$previousdate = $date;\r\n\r\n\t\t\t\t$temp->addRow(\"#060622\");\r\n\t\t\t\t$temp->addCol(\"ID\");\r\n\t\t\t\t$temp->addCol(\"Starttime\");\r\n\t\t\t\t$temp->addCol(\"Starts in / Runs for\");\r\n\t\t\t\t$temp->addCol(\"Mission Type\");\r\n\t\t\t\t$temp->addCol(\"Short Description\");\r\n\t\t\t\t$temp->addCol(\"System\");\r\n\t\t\t\t$temp->addCol(\"Security\");\r\n\t\t\t\tif ($MySelf->canDeleteEvents()) {\r\n\t\t\t\t\t$temp->addCol(\"Delete\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Add Event to the current database.\r\n\t\t\t$temp->addRow();\r\n\t\t\t$temp->addCol(\"<a href=\\\"index.php?action=showevent&id=\" . $event[id] . \"\\\">\" . str_pad($event[id], 4, \"0\", STR_PAD_LEFT) . \"</a>\");\r\n\t\t\t$temp->addCol(date(\"d.m.y H:i\", $event[starttime]));\r\n\r\n\t\t\t$delta = $TIMEMARK - $event[starttime];\r\n\t\t\tif ($TIMEMARK > $event[starttime]) {\r\n\t\t\t\t// Event underway.\r\n\t\t\t\t$temp->addCol(\"<font color=\\\"#00ff00\\\">\" . numberToString($delta) . \"</font>\");\r\n\t\t\t} else {\r\n\t\t\t\t// Event not started yet.\r\n\t\t\t\t$delta = $delta * -1;\r\n\t\t\t\t$temp->addCol(\"<font color=\\\"#ffff00\\\">\" . numberToString($delta) . \"</font>\");\r\n\t\t\t}\r\n\r\n\t\t\t$temp->addCol($event[type]);\r\n\t\t\t$temp->addCol($event[sdesc]);\r\n\t\t\t$temp->addCol($event[system]);\r\n\t\t\t$temp->addCol($event[security]);\r\n\t\t\t\r\n\t\t\tif ($MySelf->canDeleteEvents()) {\r\n\t\t\t\t$temp->addCol(\"<a href=\\\"index.php?action=deleteevent&id=$event[id]\\\">delete event</a>\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Lets recall, did we have events scheduled?\r\n\tif ($haveEvents) {\r\n\t\t// We do!\t\t\t\r\n\t\t$html = \"<h2>Scheduled Events</h2>\" . $html . $temp->flush();\r\n\t} else {\r\n\t\t// We dont!\t\t\t\r\n\t\t$html = \"<h2>Scheduled Events</h2><b>There are currently no scheduled events in the database.</b>\";\r\n\t}\r\n\t// Return what we got.\r\n\treturn ($html);\r\n\r\n}", "function showEventList($groupId, $title) {\n\t\n\t//read config file for this portlet\n\t$config = new ConfigReader();\n\t$config->loadConfigFile('assets/core/config/widgets/showGroup/event_list.properties');\n\t\n\t$maxDisplay = $config->readValue('maxDisplay');\n\t$showSummary = $config->readValue('displaySummary');\n\t$w = $config->readValue('maxImageSizeX');\n\t$h = $config->readValue('maxImageSizeY');\n\t\n\t//create user groups validation object\n\t$userGroup = new CategoryUserGroupValidator();\n\t$excludeCategories = $userGroup->viewCategoryExclusionList('events');\n\t\n\t$return .= \"\t\t\t\t<div id=\\\"event_list\\\">\\n\";\n\t$return .= \"\t\t\t\t\t<div class=\\\"header\\\">$title</div>\\n\";\n\t$return .= \"\t\t\t\t\t<div class=\\\"body\\\">\\n\";\n\t$return .= \"\t\t\t\t\t\t<div id=\\\"upcoming_events_container\\\">\\n\";\n\t\n\t$todaysDate = getdate();\n\t\n\t$month = $todaysDate['mon'];\n\t$day = $todaysDate['mday'];\n\t$year = $todaysDate['year'];\n\t\n\t$getDate = $todaysDate['year'] . \"-\" . $todaysDate['mon'] . \"-\" . $todaysDate['mday'] . \" 00:00:00\";\n\t\n\t$s = 0;\n\t\n\t$result = mysql_query(\"SELECT events.id FROM events LEFT JOIN groupsMembers ON events.groupId = groupsMembers.parentId WHERE events.groupId = '{$groupId}' AND events.startDate >= '{$getDate}' AND events.publishState = 'Published'$excludeCategories AND ((events.private = '1' AND groupsMembers.parentId = events.groupId AND groupsMembers.username = '{$_SESSION['username']}' AND groupsMembers.status = 'approved') OR (events.private = '0')) GROUP BY events.id\");\n\t$totalRows = mysql_num_rows($result);\n\t\n\t//if there's nothing to display, just exit (remove this test to display \"no events currently scheduled\" message)\n\tif ($totalRows == 0) {\n\t\t\n\t\treturn;\n\t\t\n\t}\n\t\n\t$showTotalPages = ceil($totalRows / $maxDisplay);\n\n\tif ($totalRows > 0) {\n\n\t\t$showCurrentPage = floor($s / $maxDisplay) + 1;\n\n\t} else {\n\n\t\t$showCurrentPage = 0;\n\n\t}\n\t\n\t$result = mysql_query(\"SELECT events.id, events.title, events.summary, events.summaryImage, DATE_FORMAT(startDate, '%M %d, %Y %h:%i %p') AS newStartDate, DATE_FORMAT(expireDate, '%M %d, %Y %h:%i %p') AS newExpireDate FROM events LEFT JOIN groupsMembers ON events.groupId = groupsMembers.parentId WHERE events.groupId = '{$groupId}' AND events.startDate >= '{$getDate}' AND events.publishState = 'Published'$excludeCategories AND ((events.private = '1' AND groupsMembers.parentId = events.groupId AND groupsMembers.username = '{$_SESSION['username']}' AND groupsMembers.status = 'approved') OR (events.private = '0')) GROUP BY events.id ORDER BY startDate ASC, title ASC LIMIT $maxDisplay\");\n\t$count = mysql_num_rows($result);\n\t\n\tif ($count > 0) {\n\t\t\n\t\twhile ($row = mysql_fetch_object($result)) {\n\t\t\t\n\t\t\t$x++;\n\t\t\t\n\t\t\tif ($x < $count) {\n\t\t\t\t\n\t\t\t\t$style = \" event_item_row_separator\";\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$style = \"\";\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$title = htmlentities($row->title);\n\t\t\t\n\t\t\tif (trim($row->summaryImage) != \"\") {\n\t\t\t\t\n\t\t\t\t$image = \"\t\t\t\t\t\t\t<div class=\\\"summary_image\\\">\\n<a href=\\\"/events/id/$row->id\\\"><img src=\\\"/file.php?load=$row->summaryImage&w=$w&h=$h\\\"></a></div>\\n\";\n\t\t\t\t$imageOffsetClass = \" image_offset\";\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t$image = \"\";\n\t\t\t\t$imageOffsetClass = \"\";\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$return .= \"\t\t\t\t\t\t<div class=\\\"event_item$style\\\">\\n\";\n\t\t\t$return .= \"$image\";\n\t\t\t$return .= \"\t\t\t\t\t\t\t<div class=\\\"details_container$imageOffsetClass\\\">\\n\";\n\t\t\t$return .= \"\t\t\t\t\t\t\t\t<div class=\\\"title\\\"><a href=\\\"/events/id/$row->id\\\">$title</a></div>\\n\";\n\t\t\t$return .= \"\t\t\t\t\t\t\t\t<table border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\\n\";\n\t\t\t$return .= \"\t\t\t\t\t\t\t\t\t<tr><td class=\\\"start_date\\\">$row->newStartDate</td></tr><tr><td class=\\\"end_date\\\">$row->newExpireDate</td></tr>\\n\";\n\t\t\t$return .= \"\t\t\t\t\t\t\t\t</table>\\n\";\n\t\t\t\n\t\t\tif ($showSummary == \"true\") {\n\t\t\t\t\n\t\t\t\t$summary = preg_replace(\"/\\\\n/\", \"<br>\", htmlentities($row->summary));\n\t\t\t\t\t\n\t\t\t\t$return .= \"\t\t\t\t\t\t\t<div class=\\\"summary\\\">\\n\";\n\t\t\t\t$return .= \"\t\t\t\t\t\t\t\t$summary\\n\";\n\t\t\t\t$return .= \"\t\t\t\t\t\t\t</div>\\n\";\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$return .= \"\t\t\t\t\t\t\t</div>\\n\";\n\t\t\t$return .= \"\t\t\t\t\t\t</div>\\n\";\n\t\t\t\n\t\t}\n\t\t\n\t\t$return .= \"<div id=\\\"event_list_navigation\\\">\";\n\t\t$return .= \"\t<div class=\\\"totals\\\">$totalRows Events</div><div class=\\\"navigation\\\"><div class=\\\"pages\\\">Page: $showCurrentPage of $showTotalPages</div><div class=\\\"previous\\\"><a href=\\\"javascript:regenerateEventList('$s', 'b');\\\">Previous</a></div><div class=\\\"next\\\"><a href=\\\"javascript:regenerateEventList('$s', 'n');\\\">Next</a></div></div>\";\n\t\t$return .= \"</div>\";\n\t\t\n\t} else {\n\t\t\n\t\t$return .= \"\t\t\t\t\t\t\t<div class=\\\"event_item\\\">No events are currently scheduled.</div>\\n\";\n\t\t\n\t}\n\t\n\t$return .= \"\t\t\t\t\t\t</div>\\n\";\n\t$return .= \"\t\t\t\t\t</div>\\n\";\n\t$return .= \"\t\t\t\t</div>\\n\";\n\t\n\treturn($return);\n\t\n}", "function listEventInfo() {\n\t\t$query = \"SELECT e_description, c_name, tag_name, start_datetime, end_datetime, capacity, v.name AS vname, address,o.name AS oname, v.address, v.city, v.state, v.postal_code \n\t\tFROM yam14.F_event e, yam14.F_venue v, yam14.F_category c, yam14.F_topic t, yam14.F_organizer o\n\t\tWHERE e.venue_id = v.v_id \n\t\tAND c.c_id = e.c_id \n\t\tAND t.tag_id = e.tag_id \n\t\tAND o.o_id = e.organizer_id\n\t\tAND e.e_id = $this->eid ;\";\n\t\t\n\t\t$result = mysql_query($query);\n\t\tif (!$result) {\n\t\t\t$message='Invalid Query' .mysql_errno().\" \\n\";\n\t\t $message .= 'Whole Query' . $query;\n\t\t die($message);\n\t\t}//end if\n\t\t\n\t\twhile($row = mysql_fetch_assoc($result)){\n\t\t\t$this->category = $row['c_name'];\n\t\t\t$this->tag = $row['tag_name'];\n\t\t\t$this->description = $row['e_description'];\n\t\t\t$this->startdate = date('l, M d, Y',strtotime($row['start_datetime']));\n\t\t\t$this->starttime = date('H:i A',strtotime($row['start_datetime']));\n\t\t\t$this->enddate = date('l, M d, Y',strtotime($row['end_datetime']));\n\t\t\t$this->endtime =date('H:i A',strtotime($row['end_datetime']));\n\t\t\t$this->capacity = $row['capacity'];\n\t\t\t$this->venue = $row['vname'];\n\t\t\t$this->address = $row['address'] . \", \" . $row['city'] . \", \" . $row['state'] . \" \" . $row['postal_code'];\n\t\t\t$this->organizer = $row['oname'];\n\t\t\techo \"<hr />\";\n\t\t\techo \"<div class=\\\"panel panel-default\\\">\";\n\t\t\techo \t\"<div class=\\\"panel-heading\\\">\";\n\t\t\techo \t\"<h3 class=\\\"panel-title\\\">Event Information</h3>\";\n\t\t\techo \t\"</div>\";\n\t\t\techo \t\"<div class=\\\"panel-body\\\">\";\n\t\t\techo \"<p><b>Description: </b>$this->description</p>\";\n\t\t\techo \t\"<p><b>Category: </b>$this->category</p>\";\n\t\t\techo \t\"<p><b>Topic: </b>$this->tag</p>\";\n\t\t\techo \t\"<p><b>Start Date: </b>$this->startdate</p>\";\n\t\t\techo \t\"<p><b>Start Time: </b>$this->starttime</p>\";\n\t\t\techo \t\"<p><b>End Date: </b>$this->enddate</p>\";\n\t\t\techo \t\"<p><b>End Time: </b>$this->endtime</p>\";\n\t\t\techo \t\"<p><b>Capacity: </b>$this->capacity</p>\";\n\t\t\techo \t\"<p><b>Organizer: </b>$this->organizer</p>\";\n\t\t\techo \t\"<p><b>Location: </b>$this->venue</p>\";\n\t\t\techo \t\"<p><b>Address: </b>$this->address</p>\";\n\t\t\t\n\t\t\techo \t\"</div>\";\n\t\t\techo \t\"</div>\";\n\t\t\t\t\n\t\t\t\n\t\t\t\t\t\t\n\t\t}\t\n\t\t\n\t\tmysql_free_result($result);\n\t}", "private function makeDayHeadings()\n\t{\n\t\t$this->outArray['dayheadings'] = array();\n\t\t$this->dayHeadings .= \"\\t<tr>\\n\";\n\t\tforeach($this->daysArray as $day) {\n\t\t\t$this->dayHeadings .= \"\\t\\t<th class=\\\"dayHeading\\\">$day</th>\\n\";\n\t\t\tarray_push($this->outArray['dayheadings'], $day);\n\t\t}\n\t\t$this->dayHeadings .= \"\\t</tr>\\n\";\n\t\t\n\t\t$this->calWeekDays .= $this->dayHeadings;\n\t}", "function getEvents($date = ''){\r\n\t//Include db configuration file\r\n\tinclude 'dbConfig.php';\r\n\t$eventListHTML = '';\r\n\t$date = $date?$date:date(\"Y-m-d\");\r\n\t//Get events based on the current date\r\n\t$result = $db->query(\"SELECT title FROM cakemaker WHERE date = '\".$date.\"' AND status = 1\");\r\n\tif($result->num_rows > 0){\r\n\t\t$eventListHTML = '<h2>Events on '.date(\"l, d M Y\",strtotime($date)).'</h2>';\r\n\t\t$eventListHTML .= '<ul>';\r\n\t\twhile($row = $result->fetch_assoc()){ \r\n $eventListHTML .= '<li>'.$row['title'].'</li>';\r\n }\r\n\t\t$eventListHTML .= '</ul>';\r\n\t}\r\n\techo $eventListHTML;\r\n}", "function render($events){\n\t\t// in the weekly event view\n\t\t$number_of_events=sizeof($events);\n\t\t$i=0;\n\t\t$return_val=\"\";\n\t\twhile($i<$number_of_events){\n\t\t\t$next_event=$events[$i];\n\t\t\t$return_val=$return_val.\"<a href=\\\"event_display_detail.php?event_id=\";\n\t\t\t$return_val=$return_val.($next_event->get_id());\n\t\t\t$return_val=$return_val.\"&amp;day=\".$next_event->get_start_day();\n\t\t\t$return_val.=\"&amp;month=\".$next_event->get_start_month();\n\t\t\t$return_val.=\"&amp;year=\".$next_event->get_start_year();\n\t\t\t$return_val.=\"\\\" class=\\\"eventTitle\\\">\";\n\t\t\t$return_val=$return_val.(htmlspecialchars($next_event->get_title()));\n\t\t\t$return_val=$return_val.\"</a><br />\";\n\n\t\t\t$start_time_obj=$next_event->get_start_time_object();\n\t\t\t$display_timerange=$start_time_obj->get_display_time();\n\t\t\tif ($next_event->get_duration()>0){\n\t\t\t\t$end_time_obj=$next_event->get_end_time_object();\n\t\t\t\t$display_timerange=$display_timerange.\" - \".$end_time_obj->get_display_time();\n\n\t\t\t}\n\n\t\t\t$return_val=$return_val.$display_timerange.\"<br />\";\n\t\t\tif (strlen(trim($next_event->get_event_type_name()))>0){\n\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_event_type_name()).\"<br />\";\n\t\t\t}\n\t\t\tif (strlen(trim($next_event->get_location_name()))>0){\n\t\t\t\t$return_val=$return_val.htmlspecialchars($next_event->get_location_name()).\"<br />\";\n\t\t\t}\n\t\t\t$return_val=$return_val.\"<br />\";\n\t\t\t$i=$i+1;\n\t\t}\n\t\tif (strlen($return_val)==0){\n\t\t\treturn \"&nbsp;\";\n\t\t}\n\t\treturn $return_val;\n\t}", "function obj_cx_events_list_inner( $events, $bottom_banner, $pagination, $event_list_deets = null ) {\n echo '<h3 class=\"section-title green\">Upcoming events</h3>';\n obj_do_cx_events_list_filter( $events );\n obj_do_cx_events_list( $events );\n obj_do_cx_event_bottom_banner_output( $bottom_banner );\n obj_do_cx_events_list_pagination( $pagination );\n}", "public function getDateEntries()\n\t{\n\t\t//Get Date\n\t\t$dateSubmit = \\Input::get('eventDate_submit');\n\t\t//Get Week\n\t\t$week = $this->timesheet->getWeek($dateSubmit);\n\t\t//Get the user id of the currently logged in user\n\t\t$userId = \\Sentry::getUser()->id;\n\t\t//Get Tasks List\n\t\t$tasks = $this->timesheet->getIndex($userId);\n\t\t//Get Entries\n\t\t$entries = $this->timesheet->getEntries($dateSubmit,$userId);\n\t\treturn \\View::make('dashboard.timesheet.view')\n\t\t\t\t\t->with('week',$week)\n\t\t\t\t\t->with('tasks',$tasks)\n\t\t\t\t\t->with('selectedDate',$dateSubmit)\n\t\t\t\t\t->with('entries', $entries);\n\t}", "function ShowEvents()\n {\n $this->ReadEvents();\n echo\n $this->H(1,$this->MyLanguage_GetMessage(\"Events_Table_Title\")).\n $this->EventsHtmlTable(),\n \"\";\n }", "public function index() {\n $this->seo(array(\n \"title\" => \"All Events List\",\n \"keywords\" => \"events, new events, event management, create event, event tickets, book event tickets\",\n \"description\" => \"Display all the latest events. Filter the events by categories, location and much more. Register yourself to turn your passion into your business\",\n \"view\" => $this->getLayoutView()\n ));\n $view = $this->getActionView();\n\n $title = RequestMethods::get(\"title\", \"\");\n $category = RequestMethods::get(\"category\", \"\");\n $type = RequestMethods::get(\"type\", \"\");\n $limit = RequestMethods::get(\"limit\", 10);\n $page = RequestMethods::get(\"page\", 1);\n $where = array(\n \"title LIKE ?\" => \"%{$title}%\",\n \"category LIKE ?\" => \"%{$category}%\",\n \"type LIKE ?\" => \"%{$type}%\",\n \"live = ?\" => true\n );\n $events = Event::all($where, array(\"*\"), \"created\", \"desc\", $limit, $page);\n $count = Event::count($where);\n\n $view->set(\"events\", $events);\n $view->set(\"limit\", $limit);\n $view->set(\"page\", $page);\n $view->set(\"count\", $count);\n $view->set(\"title\", $title);\n $view->set(\"type\", $type);\n $view->set(\"category\", $category);\n }", "public function actionIndex()\r\n {\r\n $events = Events::find()->all();\r\n\t\t$tasks = [];\r\n\t\tforeach ($events as $eve) {\r\n\t\t $event = new \\yii2fullcalendar\\models\\Event();\r\n\t\t $event->id = $eve->id;\r\n\t\t $event->title = $eve->title;\r\n\t\t $event->start = $eve->date_created;\r\n\t\t $tasks[] = $event;\t\t\r\n\t\t}\r\n\t\t\r\n return $this->render('index', [\r\n 'events' => $tasks,\r\n ]);\r\n }", "public function dayview()\n\t{\n\t\t$input = JFactory::getApplication()->input;\n\t\t$db = JFactory::getDbo();\n\t\t$view = $this->getView('pbbooking','html');\n\n\t\t$dateparam = $input->get('dateparam',date_create(\"now\",new DateTimeZone(PBBOOKING_TIMEZONE))->format(DATE_ATOM),'string');\n\t\t$view->dateparam = date_create($dateparam,new DateTimezone(PBBOOKING_TIMEZONE));\n\t\t$cals = $db->setQuery('select * from #__pbbooking_cals')->loadObjectList();\n\t\t$config = $db->setQuery('select * from #__pbbooking_config')->loadObject();\n\t\t$opening_hours = json_decode($config->trading_hours,true);\n\t\t$start_time_arr = str_split($opening_hours[(int)$view->dateparam->format('w')]['open_time'],2);\n\t\t$end_time_arr = str_split($opening_hours[(int)$view->dateparam->format('w')]['close_time'],2);\n\n\t\t$view->cals = array();\n\t\t$view->opening_hours = $opening_hours[(int)$view->dateparam->format('w')];\n\t\t$view->day_dt_start = date_create($dateparam,new DateTimezone(PBBOOKING_TIMEZONE));\n\t\t$view->day_dt_end = date_create($dateparam,new DateTimezone(PBBOOKING_TIMEZONE));\n\t\t$view->day_dt_start->setTime($start_time_arr[0],$start_time_arr[1],0);\n\t\t$view->day_dt_end->setTime($end_time_arr[0],$end_time_arr[1],0);\n\t\t$view->config = $config;\n\n\t\t//step back one time slot on $view->day_dt_end\n\t\t$view->dt_last_slot = clone $view->day_dt_end;\n\t\t$view->dt_last_slot->modify('- '.$config->time_increment.' minutes');\n\n\t\tforeach ($cals as $i=>$cal) {\n\t\t\t$view->cals[$i] = new Calendar();\n\t\t\t$view->cals[$i]->loadCalendarFromDbase(array($cal->id)); \n\t\t}\n\n\t\t$view->setLayout('dayview');\n\t\t$view->display();\n\t\t\n\t}", "function icalendar_render_events( $url = '', $args = array() ) {\n\t$ical = new iCalendarReader();\n\treturn $ical->render( $url, $args );\n}" ]
[ "0.6988883", "0.691454", "0.68001527", "0.6761365", "0.6699765", "0.6596786", "0.65746707", "0.6560422", "0.64417326", "0.63765466", "0.6351477", "0.6351217", "0.6314671", "0.62700576", "0.6258939", "0.6229247", "0.6220041", "0.6211291", "0.618858", "0.61027926", "0.6087735", "0.6085074", "0.6078856", "0.6072163", "0.6061979", "0.6041157", "0.60038865", "0.5997636", "0.5993342", "0.5972942" ]
0.78295594
0
Create a listing of events as an array Creates a listing of events occuring on the given day as array items. These items are added into the cell of the calendar for the given day.
private function makeDayEventListArray() { $outevents = array(); $n = 0; foreach($this->eventItems as $item) { if($item['date'] == $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth) { $outevents[$n]['category'] = $item['cat']; if($item['stdurl']) { $outevents[$n]['url'] = $item['url'].'?id='.$item['id']; } else { $outevents[$n]['url'] = $item['url']; } $outevents[$n]['summary'] = $item['text']; $outevents[$n]['description'] = $item['desc']; $outevents[$n]['categorycolor'] = (strlen($item['catcolor']) > 0 ? str_replace('#','',$item['catcolor']) : '#eeeeee'); } $n++; } if(count($outevents)) { return $outevents; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getEventsByDay( $day ) {\n\n\t\t$rangestart = strtotime($day) * 1000; // zimbra always works with milliseconds in timestamps\n\t\t$rangeend = $rangestart + (24 * 60 * 60 * 1000);\n\n\t\t/**\n\t\t* build full call url\n\t\t*/\n\t\t$calendar = $this->getFromZimbra(\"/calendar?start=\" . $rangestart . \"&end=\" . $rangeend);\n\n\t\t$events = array();\n\t\tif( !property_exists($calendar, \"appt\") ) return $events;\n\n\t\tforeach ($calendar->appt as $meetingSeries) {\n\n\t\t\t/**\n\t\t\t* collect values for the current appointment\n\t\t\t*/\n\t\t\t$finalstartdate = null;\n\t\t\t$finalenddate = null;\n\t\t\t$finalname = null;\n\t\t\t$finallocation = null;\n\n\t\t\t/**\n\t\t\t* iterate over all sub events in order to find the right one\n\t\t\t* single events just have one item = easy, we just take this one\n\t\t\t* series of events contain the original item plus all execptions, more difficult to handle\n\t\t\t*/\n\t\t\tforeach ($meetingSeries->inv as $meeting) {\n\n\t\t\t\t$startdate = isset($meeting->comp[0]->s[0]->u) ? $meeting->comp[0]->s[0]->u : \"\";\n\t\t\t\t$enddate = isset($meeting->comp[0]->e[0]->u) ? $meeting->comp[0]->e[0]->u: \"\";\n\t\t\t\t$name = $meeting->comp[0]->name;\n\t\t\t\t$location = $meeting->comp[0]->loc;\n\n\t\t\t\t/**\n\t\t\t\t* we take the original, if nothing is set yet\n\t\t\t\t* the original events hold the time from the original day only, so we need to recalculate\n\t\t\t\t* since we are only getting the data from one day, we can kill the day information on extract the hours only\n\t\t\t\t*/\n\t\t\t\tif( $finalstartdate == null && !property_exists($meeting->comp[0], \"recurId\")) {\n\t\t\t\t\t$finalstartdate = date(\"Y-m-d\", $rangestart/1000) . \" \" . date(\"H:i\", $startdate / 1000);\n\t\t\t\t\t$finalenddate = date(\"Y-m-d\", $rangestart/1000) . \" \" . date(\"H:i\", $enddate / 1000);\n\t\t\t\t\t$finalname = $name;\n\t\t\t\t\t$finallocation = $location;\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t* overwrite if got an exception of the series taking place on the current day\n\t\t\t\t*/\n\t\t\t\tif( property_exists($meeting, \"recurId\") &&\n\t\t\t\t\t($startdate <= $rangeend && $enddate >= $rangestart)) {\n\t\t\t\t\t$finalstartdate = date(\"Y-m-d H:i\", $startdate / 1000);\n\t\t\t\t\t$finalenddate = date(\"Y-m-d H:i\", $enddate / 1000);\n\t\t\t\t\t$finalname = $name;\n\t\t\t\t\t$finallocation = $location; \n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$events[]= array(\n\t\t\t\t\"name\" => $finalname,\n\t\t\t\t\"location\" => $finallocation,\n\t\t\t\t\"startdate\" => $finalstartdate, // timestamp has milli seconds as well\n\t\t\t\t\"enddate\" => $finalenddate\n\t\t\t);\n\t\t}\n\n\t\tusort($events, array(\"self\", \"cmp\"));\n\t\treturn $events;\n\t}", "function _makeDay($carbon){\n $_date = $carbon->year.'-'.$carbon->month.'-'.$carbon->day;\n $day = $carbon->englishDayOfWeek;\n return [\n 'date' => $carbon->day,\n 'month' => $carbon->month,\n 'year' => $carbon->year,\n 'english_month' => $carbon->englishMonth,\n 'full_date' => $_date,\n 'day' => $day,\n 'items' => [],\n ];\n }", "function get_event_days(){\r\n\t\t$event_days = array();\r\n\r\n\t\tforeach($this->merged_feed_data as $item){\r\n\t\t\t$start_date = $item->get_start_date();\r\n\r\n\t\t\t//Round start date to nearest day\r\n\t\t\t$start_date = mktime(0, 0, 0, date('m', $start_date), date('d', $start_date) , date('Y', $start_date));\r\n\r\n\t\t\tif(!isset($event_days[$start_date])){\r\n\t\t\t\t//Create new array in $event_days for this date (only dates with events will go into array, so, for \r\n\t\t\t\t//example $event_days[26] will exist if 26th of month has events, but won't if it has no events)\r\n\t\t\t\t//(Now uses unix timestamp rather than day number, but same concept applies).\r\n\t\t\t\t$event_days[$start_date] = array();\r\n\t\t\t}\r\n\r\n\t\t\t//Push event into array just created (may be another event for this date later in feed)\r\n\t\t\tarray_push($event_days[$start_date], $item);\r\n\t\t}\r\n\r\n\t\treturn $event_days;\r\n\t}", "private function add_events()\r\n {\r\n $events = $this->events;\r\n foreach ($events as $time => $items)\r\n {\r\n $column = date('H', $time) / $this->hour_step + 1;\r\n foreach ($items as $item)\r\n {\r\n $content = $item['content'];\r\n $row = $item['index'] + 1;\r\n \r\n $cell_content = $this->getCellContents($row, $column);\r\n $cell_content .= $content;\r\n $this->setCellContents($row, $column, $cell_content);\r\n }\r\n }\r\n \r\n }", "private function makeArrayIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\t\t\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'normalDay';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'weekendDay';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'currentDay';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t} \n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['dayname'] = $this->daysArray[$this->weekDayNum - 1];\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['weekdaynumber'] = $this->weekDayNum;\n\t\t\t\t\t\t\t\t\t\n\t\t\t// Draw days\n\t\t\tif($this->makeDayEventListArray()) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['events'] = $this->makeDayEventListArray();\n\t\t\t}\n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['datestamp'] = $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth;\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "public function buildDayList($date){\n\t\t$events = $this->getDayEvents($date);\n\t\t$count = 0;\n\t\t\n\t\tob_start();\n\t\tif(count($events) > 0){\n\t\t\tforeach($events as $key => $event){\t\t\t\n\t\t\t\t$recurringDays = $event->getRecurringDays();\n\t\t\t\t\t\t\n\t\t\t\t$dayOfWeek = date_create($date);\n\t\t\t\t$dayOfWeek = strtolower(date_format($dayOfWeek, \"l\"));\n\t\t\t\t//echo $dayOfWeek;\n\n\t\t\t\tif(count($recurringDays)){\n\t\t\t\t\tif(in_array($dayOfWeek, $recurringDays)){\n\t\t\t\t\t\techo '<h4>Events for ' . $this->getDate($date) . '</h4>';\n\t\t\t\t\t\techo $event->toHtml('listing');\n\t\t\t\t\t\techo '<hr />';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\techo '<h4>Events for ' . $this->getDate($date) . '</h4>';\n\t\t\t\t\techo $event->toHtml('listing');\n\t\t\t\t\techo '<hr />';\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t$count++;\n\t\t\t}\n\t\t}\n\t\treturn ob_get_clean();\n\t}", "private function getNewTicketsByDayList() {\r\n\t\t$sql = \"SELECT dateadd(DAY,0, datediff(day,0, Date_Entered_UTC)) AS day, count(TicketNbr) as count \";\r\n\t\t$sql .= \"FROM v_rpt_Service \";\r\n\t\t$sql .= \"WHERE Date_Entered_UTC >= DATEADD(day, -30, GETDATE()) \";\r\n\t\t$sql .= \"GROUP BY dateadd(DAY,0, datediff(day,0, Date_Entered_UTC)) \";\r\n\t\t$sql .= \"ORDER BY dateadd(DAY,0, datediff(day,0, Date_Entered_UTC)) \";\r\n\t\t$result = sqlsrv_query($this->conn, $sql) or die ('Error in SQL: ' . $sql);\r\n\r\n\t\t$i = 0;\r\n\t\twhile($row = sqlsrv_fetch_array($result)) {\r\n\t\t\t$r[$i]['date'] = (strtotime($row['day'])*1000)-6*60*60*1000;\r\n\t\t\t$r[$i]['count'] = (string)$row['count'];\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\treturn($r);\r\n\t}", "public function drawArray()\n\t{\n\t\t$this->outArray['days'] = array();\n\t\t$this->makeCalendarTitle();\n\t\t$this->makeCalendarHead();\n\t\t$this->makeDayHeadings();\n\t\t$this->startMonthSpacers();\n\t\t$this->makeArrayIterator();\n\t\t$this->endMonthSpacers();\t\t\n\t\t\n\t\treturn $this->outArray;\n\t}", "public function getDayEvents($date){\n\t\t$object = $this->events_ob;\n\t\t$event = new $object();\n\t\t$events = array();\n\t\t\n\t\t# Get Non-Reoccurring events\n\t\t$query = \"WHERE `start_date` = '\".$date.\"' AND `repeating` = '0' AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Reoccurring events\n\t\t# Get Events that Reoccur on a daily basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'daily' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(DAY, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a weekly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'weekly' AND `repeat_wednesday` = '1' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(WEEK, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a monthly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'monthly' AND ((`repeat_by` = 'day_of_month' AND DAY(`start_date`) = '16') OR (`repeat_by` = 'day_of_week' AND DAYOFWEEK(`start_date`) = '4' AND MOD((TIMESTAMPDIFF(WEEK, '2017-08-01', '\".$date.\"')+1), `repeat_every`) = 0)) AND `repeat_every` <> 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a yearly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'yearly' AND DAY(`start_date`) = '16' AND MONTH(`start_date`) = '8' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(YEAR, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\treturn $events;\n\t}", "private function _get_calendar_array()\n\t{\n\t $this->all_events = $this->result->xpath(\".//event\");\n\t \n\t foreach($this->all_events as $an_event):\n\t $start_at = $an_event->xpath(\"./start-at\");\n \t $start_at = $start_at[0];\n \t $end_at = $an_event->xpath(\"./end-at\");\n \t $end_at = $end_at[0];\n \t \n \t $start_at = new DateTime($start_at);\n \t $start_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $start_at->setTime(0, 0, 0);\n \t $end_at = new DateTime($end_at);\n \t $end_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $end_at->setTime(0, 0, 0);\n \t \n \t $start_timestamp = strtotime($start_at->format('Y-m-d'));\n $end_timestamp = strtotime($end_at->format('Y-m-d'));\n \n $start_year = date(\"Y\", $start_timestamp);\n $end_year = date(\"Y\", $end_timestamp);\n $start_month = date(\"m\", $start_timestamp);\n $end_month = date(\"m\", $end_timestamp);\n $start_day = date(\"d\", $start_timestamp);\n $start_day = $start_day + 1;\n $end_day = date(\"d\", $end_timestamp);\n $end_day = $end_day + 1;\n \n if(($start_year == $this->year && $start_month == $this->month) || ($end_year == $this->year && $end_month == $this->month)):\n if($start_year == $end_year):\n if($start_month == $end_month):\n $this->_calendar_array_one($start_day, $end_day);\n else:\n if($end_month != $this->month):\n $this->_calendar_array_two($start_day);\n else:\n $this->_calendar_array_three($end_day);\n endif;\n endif;\n endif;\n endif;\n endforeach;\n \n\t foreach($this->callinks as $callinks):\n\t foreach($callinks as $key => $value):\n\t $this->combined_callinks[\"$key\"] = $value;\n\t endforeach;\n\t endforeach;\n\t}", "private function _calendar_array_one($start_d, $end_d)\n\t{\n\t $days_array = array();\n $days_url_array = array();\n for($i = $start_d; $i <= $end_d; $i++):\n array_push($days_array, $i);\n endfor;\n \n foreach($days_array as $day):\n $stampeddate = strtotime($this->year.\"-\".$this->month.\"-\".$day);\n array_push($days_url_array, URL::base(TRUE, TRUE).\"calendar_day/\".date(\"j\", $stampeddate).\"/\".date(\"n\", $stampeddate).\"/\".date(\"Y\", $stampeddate));\n endforeach;\n \n array_push($this->callinks, array_combine($days_array, $days_url_array));\n\t}", "private function makeDayEventListHTML()\n\t{\n\t\t$showtext = \"\";\n\t\tforeach($this->eventItems as $item) {\n\t\t\tif($item['date'] == $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth) {\n\t\t\t\t$category = (strlen($item['cat']) > 0 ? 'Category: '.$item['cat'].' - ' : '');\n\t\t\t\t$outevents[$n]['category'] = $item['cat'];\n\t\t\t\t\n\t\t\t\tif($item['stdurl']) {\n\t\t\t\t\t$href = '<a href=\"'.$item['url'].'?id='.$item['id'].'\" title=\"'.$category.$item['desc'].'\">'.$item['text'].'</a>';\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'].'?id='.$item['id'];\n\t\t\t\t} else {\n\t\t\t\t\t$href = (strlen($item['url']) > 0 ? '<a href=\"'.$item['url'].'\" title=\"'.$category.$item['desc'].'\">'.$item['text'].'</a>' : $item['text']);\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$style = (strlen($item['catcolor']) > 0 ? ' style=\"background-color:#'.str_replace('#','',$item['catcolor']).';\" ' : ' style=\"background-color:#eeeeee;\" ');\n\t\t\t\t\n\t\t\t\t$showtext .= \"\\n\\t\\t\\t<div class=\\\"dayContent\\\"\".$style.\">\".$href.\"</div>\\n\\t\\t\";\n\t\t\t\t\n\t\t\t\t$outevents[$n]['summary'] = $item['text'];\n\t\t\t\t$outevents[$n]['description'] = $item['desc'];\n\t\t\t\t$outevents[$n]['categorycolor'] = (strlen($item['catcolor']) > 0 ? str_replace('#','',$item['catcolor']) : '#eeeeee');\n\t\t\t}\n\t\t\t$n++;\n\t\t}\n\t\treturn $showtext;\n\t}", "public static function twoDArrayforCalender()\n {\n $array = [];\n for ($i = 0; $i < 6; $i++) \n {\n $array1 = array();\n for ($j = 0; $j < 7; $j++) \n {\n //initializing array values to '-'\n $array1[$j] = '-';\n }\n //pushing array to each row of 2d array\n array_push($array, $array1);\n }\n return $array;\n }", "private function baseCalendarArray($date, $fday, $lday, $monthHolidays){\n $calendar = array();\n for($day = $fday; $day < $lday+1; $day++)\n {\n\n $calendar = $this->setDay($calendar, $day);\n $calendar = $this->setDayName($calendar, $day, $this->date, \"D\");\n\n if(!empty($event[$day]))\n $calendar = $this->setDayEvent($calendar, $day, $event[$day]);\n \n\n if($date->isWeekend())\n {\n $calendar = $this->setDayWeekend($calendar, $day, \"Weekend\");\n $calendar = $this->setDayColor($calendar, $day, 'purple');\n }\n else \n {\n $calendar = $this->setDayColor($calendar, $day, 'white');\n }\n\n if(!empty($monthHolidays[$day]))\n {\n $calendar = $this->setDayEvent($calendar, $day, $monthHolidays[$day]['event']);\n $calendar = $this->setDayColor($calendar, $day, 'pink');\n }\n \n $date->addDay();\n }\n\n return $calendar;\n }", "public function getEvents()\n {\n $main_actions = [\n 'event' => \\adminer\\lang('Create event'),\n ];\n\n $headers = [\n \\adminer\\lang('Name'),\n \\adminer\\lang('Schedule'),\n \\adminer\\lang('Start'),\n // \\adminer\\lang('End'),\n ];\n\n // From db.inc.php\n $events = \\adminer\\support(\"event\") ? \\adminer\\get_rows(\"SHOW EVENTS\") : [];\n $details = [];\n foreach($events as $event)\n {\n $detail = [\n 'name' => \\adminer\\h($event[\"Name\"]),\n ];\n if(($event[\"Execute at\"]))\n {\n $detail['schedule'] = \\adminer\\lang('At given time');\n $detail['start'] = $event[\"Execute at\"];\n // $detail['end'] = '';\n }\n else\n {\n $detail['schedule'] = \\adminer\\lang('Every') . \" \" .\n $event[\"Interval value\"] . \" \" . $event[\"Interval field\"];\n $detail['start'] = $event[\"Starts\"];\n // $detail['end'] = '';\n }\n $details[] = $detail;\n }\n\n return \\compact('main_actions', 'headers', 'details');\n }", "private function getNewOpportunitiesByDayList() {\r\n\t\t$sql = \"SELECT dateadd(DAY,0, datediff(day,0, Date_Became_Lead)) AS day, count(Opportunity_RecID) as count \";\r\n\t\t$sql .= \"FROM v_rpt_Opportunity \";\r\n\t\t$sql .= \"WHERE Date_Became_Lead >= DATEADD(day, -30, GETDATE()) \";\r\n\t\t$sql .= \"GROUP BY dateadd(DAY,0, datediff(day,0, Date_Became_Lead)) \";\r\n\t\t$sql .= \"ORDER BY dateadd(DAY,0, datediff(day,0, Date_Became_Lead)) \";\r\n\t\t$result = sqlsrv_query($this->conn, $sql) or die ('Error in SQL: ' . $sql);\r\n\r\n\t\t$i = 0;\r\n\t\twhile($row = sqlsrv_fetch_array($result)) {\r\n\t\t\t$r[$i]['date'] = (strtotime($row['day'])*1000);\r\n\t\t\t$r[$i]['count'] = (string)$row['count'];\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\treturn($r);\r\n\t}", "public function reminders($day)\n {\n return $this->events->eventsByDay($day);\n }", "public function dayList()\n\t{\n\t\techo json_encode($this->sched_day->fetchData());\n\t}", "public function dataProvider_for_createCalendarEvent()\n {\n return [\n 'not_recurring' => [\n [\n 'title' => str_random(16),\n 'start_datetime' => Carbon::parse('2017-08-25 10:00:00'),\n 'end_datetime' => Carbon::parse('2017-08-25 12:00:00'),\n 'description' => str_random(32),\n 'is_recurring' => false,\n 'is_public' => true,\n ],\n ],\n 'recurring' => [\n [\n 'title' => str_random(16),\n 'start_datetime' => Carbon::parse('2017-08-25 10:00:00'),\n 'end_datetime' => Carbon::parse('2017-08-25 12:00:00'),\n 'description' => str_random(32),\n 'is_recurring' => true,\n 'frequence_number_of_recurring' => 1,\n 'frequence_type_of_recurring' => RecurringFrequenceType::WEEK,\n 'is_public' => true,\n ],\n ],\n ];\n }", "public function date_get_eventlist($date, $gid = 0)\n {\n if (is_array($date)) {\n $from = $this->esc($date[0]);\n $to = $this->esc($date[1]);\n } else {\n $date = $from = $to = $this->esc($date);\n }\n // Support for filtering out events from groups not included in result set according to query type\n $eventListFilter = $this->getQueryTypeFilter($gid);\n $gidFilter = $this->getGroupAndShareFilter($gid);\n\n $return = array();\n $query = 'SELECT DISTINCT e.`id` '\n .', IF(rp.`type`!=\"-\", UNIX_TIMESTAMP(CONCAT(DATE_FORMAT(\"'.$date.'\", \"%Y-%m-%d\"), \" \",DATE_FORMAT(e.`starts`, \"%T\")) ), UNIX_TIMESTAMP(e.`starts`) ) as start'\n .', IF(rp.`type`!=\"-\", UNIX_TIMESTAMP(CONCAT(DATE_FORMAT(\"'.$date.'\", \"%Y-%m-%d\"), \" \",DATE_FORMAT(e.`ends`, \"%T\")) ), UNIX_TIMESTAMP(e.`ends`) ) as end'\n .',e.`starts`, e.`ends`, e.`location`, e.`title`, e.`description`, e.`type`, e.`status`, e.`opaque`, rp.`type` `repeat_type`, rp.`until` `repeat_until`'\n .',IF(fs.`val` IS NULL, \"\", fs.`val`) `colour`'\n .', (SELECT `mode` FROM '.$this->Tbl['cal_reminder'].' WHERE `uid`='.$this->uid.' AND `eid`=e.`id` AND `ref`=\"evt\" LIMIT 1) `warn_mode`'\n .' FROM '.$this->Tbl['cal_repetition'].' rp, '.$this->Tbl['cal_event'].' e'\n .' LEFT JOIN '.$this->Tbl['cal_group'].' eg ON eg.`gid`=e.`gid`'\n .' LEFT JOIN '.$this->Tbl['user_foldersettings'].' fs ON fs.`fid`=e.`gid` AND fs.`handler`=\"calendar\" AND fs.`key`=\"foldercolour\" AND fs.uid='.$this->uid\n .$eventListFilter[0]\n .' WHERE rp.`eid`=e.`id` AND rp.`ref`=\"evt\" AND ('.$gidFilter.')'.$eventListFilter[1]\n .' AND IF (rp.`type`!=\"-\", DATE_FORMAT(e.`starts`, \"%Y%m%d\") <= DATE_FORMAT(\"'.$from.'\", \"%Y%m%d\"), 1)'\n .' AND IF (rp.`type`!=\"-\" AND rp.`until` IS NOT NULL AND rp.`until` != \"0-0-0 0:0:0\", rp.`until`>\"'.$to.'\",1) AND ('\n // Begins or ends today\n .'DATE_FORMAT(e.`starts`, \"%Y%m%d\")=DATE_FORMAT(\"'.$date.'\", \"%Y%m%d\") OR DATE_FORMAT(e.`ends`, \"%Y%m%d\")=DATE_FORMAT(\"'.$date.'\", \"%Y%m%d\") OR '\n // Begins in the past AND ends in the future\n .'( DATE_FORMAT(e.`starts`, \"%Y%m%d\")<=DATE_FORMAT(\"'.$date.'\", \"%Y%m%d\") AND DATE_FORMAT(e.`ends`, \"%Y%m%d\")>=DATE_FORMAT(\"'.$date.'\", \"%Y%m%d\") ) OR '\n // Is an event occuring yearly. Todays date matches the repetition date\n .'(rp.`type`=\"year\" AND (DATE_FORMAT(e.`starts`,\"%m%d\")=DATE_FORMAT(\"'.$date.'\", \"%m%d\") OR DATE_FORMAT(e.`ends`,\"%m%d\")=DATE_FORMAT(\"'.$date.'\",\"%m%d\"))) OR '\n // A monthly event, repetition day is today, repetition month is empty or matches\n .'(rp.`type`=\"month\" AND rp.`repeat`=DATE_FORMAT(\"'.$date.'\", \"%e\") AND (rp.`extra`=\"\" OR FIND_IN_SET(DATE_FORMAT(\"'.$date.'\", \"%c\"), rp.`extra`)>0) ) OR '\n // Monthly event on e.g. the 31st of month with months shorter than 31 days, this is only supported from MySQL 4.1.1 onward\n .'(rp.`type`=\"month\" AND rp.`repeat`=31 AND (rp.`extra`=\"\" OR FIND_IN_SET(DATE_FORMAT(\"'.$date.'\", \"%c\"), rp.`extra`)>0) AND LAST_DAY(\"'.$date.'\")=DATE_FORMAT(\"'.$date.'\", \"%Y-%m-%d\"))'\n // A weekly event, repetition weekday is today\n .' OR (rp.`type`=\"week\" AND rp.`repeat`=DATE_FORMAT(\"'.$date.'\", \"%w\") AND IF(rp.`extra` IN(\"\", \"1\"), 1, ABS(MOD(DATEDIFF(e.`starts`, \"'.$date.'\")/7, rp.`extra`))=0) ) OR '\n // A \"daily\" event, where the bit pattern should match today's weekday\n .'(rp.`type`=\"day\" AND (rp.`repeat`=\"0\" OR SUBSTRING(LPAD(BIN(rp.`repeat`), 8, 0), IF(DATE_FORMAT(\"'.$date.'\", \"%w\")=0, 8, DATE_FORMAT(\"'.$date.'\", \"%w\")+1), 1) = 1 ) )'\n .') ORDER BY `start` ASC';\n $qh = $this->query($query);\n while ($line = $this->assoc($qh)) {\n if ($line['warn_mode'] == '?') {\n $qid2 = $this->query('SELECT `mode` FROM '.$this->Tbl['cal_reminder']\n .' WHERE `uid`='.$this->uid.' AND `eid`='.$line['id'].' AND `ref`=\"evt\" AND `mode` != \"-\" LIMIT 1');\n list ($rem) = $this->fetchrow($qid2);\n $line['warn_mode'] = $rem ? $rem : '-';\n } elseif ($line['warn_mode'] == '' || is_null($line['warn_mode'])) {\n $line['warn_mode'] = '-';\n }\n $return[] = $line;\n }\n return $return;\n }", "function get_calendar_link($contents) {\n $data = array();\n foreach($contents as $k=>$row) :\n $data[$row['day']] = $row['cal_link'];\n endforeach;\n\n return $data;\n }", "function add_event_to_array($dates, $page_data, &$datePaths) {\n foreach ($page_data['dates'] as $date) {\n $start_date = (int)($date['start-date']) / 1000;\n $end_date = (int)($date['end-date']) / 1000;\n $specific_start = date(\"Y-m-d\", $start_date );\n $specific_end = date(\"Y-m-d\", $end_date );\n\n $page_data['time_string'] = $date['time-string'];\n $page_data['specific_start'] = $date['start-date'];\n $page_data['specific_end'] = $date['end-date'];\n $page_data['specific_all_day'] = $date['all-day'];\n $page_data['specific_need_time_zone'] = $date['outside-of-minnesota'];\n if($page_data['specific_need_time_zone'] == true) {\n $time_zone = $date['time-zone'];\n if ($time_zone == \"Hawaii-Aleutian Time\") {\n $page_data['specific_time_zone'] = \"HT\";\n } elseif ($time_zone == \"Alaska Time\") {\n $page_data['specific_time_zone'] = \"AT\";\n } elseif ($time_zone == \"Pacific Time\") {\n $page_data['specific_time_zone'] = \"PT\";\n } elseif ($time_zone == \"Mountain Time\") {\n $page_data['specific_time_zone'] = \"MT\";\n } elseif ($time_zone == \"Eastern Time\") {\n $page_data['specific_time_zone'] = \"ET\";\n } else {\n $page_data['specific_time_zone'] = \"CT\";\n }\n } else {\n $page_data['specific_time_zone'] = \"\";\n }\n\n if($specific_start == $specific_end){\n //Don't need a date range.\n $key = date(\"Y-m-d\", $start_date);\n add_page_to_day($dates[$key], $page_data, $datePaths[$key]);\n }\n // range of dates\n else{\n $page_data['specific_all_day'] = true;\n $start = date(\"Y-n-j\", $start_date);\n // Add 1 day to $end so that the DatePeriod includes the last day in 'end-date'\n $end = date(\"Y-n-j\", strtotime('+1 day', $end_date));\n // Create a date period for each of the dates this event-date spans.\n // This will put it on the calendar each day.\n $period = new DatePeriod(\n new DateTime($start),\n new DateInterval('P1D'),\n new DateTime($end)\n );\n // Add a listng to the array for each event / event date\n $foreach_start_time = microtime(true);\n foreach ($period as $inner_date) {\n $key = $inner_date->format('Y-m-d');\n add_page_to_day($dates[$key], $page_data, $datePaths[$key]);\n }\n\n }\n\n }\n return $dates;\n}", "public function getEntries($day)\n\t{\n\t\t//Get the user id of the currently logged in user\n\t\t$userId = Sentry::getUser()->id;\n\t\t//Get Data\n\t\t$entriesArray = $this->timesheet->getEntries($day,$userId);\n\t\t//Encode to JSON format\n\t\t$entriesJson = json_encode($entriesArray);\n\t\treturn $entriesJson;\n\t}", "function setItems($item,$from,$to,$exc_entries){\n if ($item['allday'] > 0) {\n\t\t\t$item['begin'] = strtotime(strftime('%Y-%m-%d', $item['begin']));\n\t\t\tif ($item['begin'] > $item['end'])\n\t\t\t\t$item['end'] = strtotime(strftime('%Y-%m-%d', $item['begin']).'+1day')-1;\n\t\t\telse\n\t\t\t\t$item['end'] = strtotime(strftime('%Y-%m-%d', $item['end']).'+1day')-1;\n\t\t}\n\n\t\tif($item['event_type'] > 0)\n return $this->setRecurItemsList($item, $from, $to, $exc_entries);\n $itemarray = array();\n if(strtotime(strftime('%Y-%m-%d', $item['begin']))== strtotime(strftime(\"%Y-%m-%d\", $item['end']))){\n\t\t\t$itemarray[]=$item;\n return $itemarray;\n }\n if(($item['end'] && $item['begin'] != $item['end']) AND $this->conf['showMultiDayOnlyOnce'] == 0){\n\t\t\t\t$new_item = $item;\n\t\t\t\t$lastday = $item['end'];\n\t\t\t\t$firstday = $item['begin'];\n\t\t\t\t$time = $item['begin'];\n\t\t\t\t$new_item['mday']= $item['begin'];\n\t\t\t\t$i=0;\n\t\t\t\twhile($firstday<$lastday){\n\t\t\t\t\t$new_item['begin'] = $firstday;\n\t\t\t\t\t$new_item['end'] = $lastday;\n\t\t\t\t\t$new_item['i'] = $i;\n\t\t\t\t\t$itemarray[]= $new_item;\n\t\t\t\t\t$i++;\n\t\t\t\t\t$firstday = strtotime(strftime('%Y-%m-%d', $time).'+'.$i.'days');\n\t\t\t\t}\n } else\n\t\t\t$itemarray[]=$item;\n\t\treturn $itemarray;\n }", "private function makeHTMLIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$style = 'class=\"normalDay\"';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$style = 'class=\"weekendDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$style = 'class=\"currentDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->calWeekDays .= \"\\t</tr>\\n\\t<tr>\\n\";\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t}\n\n\t\t\t// Draw days\n\t\t\t$this->calWeekDays .= \"\\t\\t<td valign=\\\"top\\\" \".$style.'>'.$this->dayOfMonth;\n\t\t\t\n\t\t\tif($this->addWeekDay) {\n\t\t\t\t$this->calWeekDays .= \"|\".$this->weekDayNum;\n\t\t\t}\n\t\t\t\n\t\t\tif(strlen($this->addEvtDest) > 0) {\n\t\t\t\t$addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src=\"'.$this->addEvtImg.'\" class=\"addevtimg\" />' : '+');\n\t\t\t\t$this->calWeekDays .= '[<a href=\"'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'\" title=\"Add Event\" class=\"addevt\">'.$addevtimg.'</a>]';\n\t\t\t}\n\t\t\t\n\t\t\t$this->calWeekDays .= \" \".$this->makeDayEventListHTML().\"</td>\\n\";\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "private function getSameDayTicketsByDayList() {\r\n\t\t$sql = \"SELECT dateadd(DAY,0, datediff(day,0, Date_Resolved_UTC)) AS day, count(TicketNbr) as count \";\r\n\t\t$sql .= \"FROM v_rpt_Service \";\r\n\t\t$sql .= \"WHERE Date_Resolved_UTC >= DATEADD(day, -30, GETDATE()) \";\r\n\t\t$sql .= \"AND ( \";\r\n\t\t$sql .= \"status_description LIKE '>%' \";\r\n\t\t$sql .= \"OR status_description LIKE 'Completed' \";\r\n\t\t$sql .= \") \";\r\n\t\t$sql .= \"AND dateadd(DAY,0, datediff(day,0, Date_Resolved_UTC)) = dateadd(DAY,0, datediff(day,0, Date_Entered_UTC)) \";\r\n\t\t$sql .= \"GROUP BY dateadd(DAY,0, datediff(day,0, Date_Resolved_UTC)) \";\r\n\t\t$sql .= \"ORDER BY dateadd(DAY,0, datediff(day,0, Date_Resolved_UTC)) \";\r\n\t\t$result = sqlsrv_query($this->conn, $sql) or die ('Error in SQL: ' . $sql);\r\n\r\n\t\t$i = 0;\r\n\t\twhile($row = sqlsrv_fetch_array($result)) {\r\n\t\t\t$r[$i]['date'] = (strtotime($row['day'])*1000)-6*60*60*1000;\r\n\t\t\t$r[$i]['count'] = (string)$row['count'];\r\n\t\t\t$i++;\r\n\t\t}\r\n\r\n\t\treturn($r);\r\n\t}", "public static function initialize_calendar(){\n \n $event_array[] = array();\n $schedules = \\App\\Event::get();\n if(!empty($schedules)){\n foreach($schedules as $schedule){\n $event_array[] = array(\n 'id' => uniqid(),\n 'title' => $schedule->description,\n 'start' => date('Y-m-d', strtotime($schedule->event_date)),\n 'end' => date('Y-m-d', strtotime($schedule->event_date)),\n 'color' => \"lightblue\",\n \"textEscape\"=> 'false' ,\n 'textColor' => 'black',\n );\n }\n return $get_schedule = json_encode($event_array);\n }\n }", "public function getEvents() : array\n {\n $events = [];\n\n for ($i = 1; $i <= 2; $i++) {\n for ($j = 1; $j <= 4; $j++) {\n for ($k = 1; $k <= 10; $k++) {\n $events []= new Event('install', $i, $j);\n\n if ($k < 3 || $j == 2)\n $events []= new Event('purchase', $i, $j);\n }\n }\n }\n\n return $events;\n }", "private function _calendar_array_two($start_d)\n\t{\n\t $days_array = array();\n $days_url_array = array();\n $days_in_month = days_in_month($this->month, $this->year) + 1;\n \n for($i = $start_d; $i < $days_in_month; $i++):\n array_push($days_array, $i);\n endfor;\n \n foreach($days_array as $day):\n $stampeddate = strtotime($this->year.\"-\".$this->month.\"-\".$day);\n array_push($days_url_array, URL::base(TRUE, TRUE).\"calendar_day/\".date(\"j\", $stampeddate).\"/\".date(\"n\", $stampeddate).\"/\".date(\"Y\", $stampeddate));\n endforeach;\n \n array_push($this->callinks, array_combine($days_array, $days_url_array));\n\t}", "public function get_event_list()\n\t{\n\treturn $this->cal['VEVENT'];\n\t}" ]
[ "0.6671869", "0.6494189", "0.6369033", "0.63672584", "0.62191", "0.6172734", "0.61669075", "0.6152314", "0.61197495", "0.6069392", "0.59930086", "0.5899545", "0.5881705", "0.5879517", "0.5862057", "0.5854946", "0.5847806", "0.5821305", "0.5820824", "0.5739708", "0.5734776", "0.5721672", "0.56829286", "0.5669619", "0.56557584", "0.5638684", "0.5633027", "0.5621582", "0.5610921", "0.5595896" ]
0.7613199
0
Iterate calendar days (HTML version) Loop through the calendar days for the given month and create cells for each day. Populate each cell with it's given events (if any) and output as a complete table contents.
private function makeHTMLIterator() { $this->weekDayNum = $this->firstDayOfTheMonth+1; for($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) { // Set the default style $style = 'class="normalDay"'; // Set the style to a weekend day style if(($this->weekDayNum == 8)||($this->weekDayNum == 7)) { $style = 'class="weekendDay"'; } // Set the style to a current day style if($this->curDay == $this->dayOfMonth) { $style = 'class="currentDay"'; } // If the current day is Sunday, add a new row if($this->weekDayNum == 8) { $this->calWeekDays .= "\t</tr>\n\t<tr>\n"; $this->weekDayNum = 1; } // Draw days $this->calWeekDays .= "\t\t<td valign=\"top\" ".$style.'>'.$this->dayOfMonth; if($this->addWeekDay) { $this->calWeekDays .= "|".$this->weekDayNum; } if(strlen($this->addEvtDest) > 0) { $addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src="'.$this->addEvtImg.'" class="addevtimg" />' : '+'); $this->calWeekDays .= '[<a href="'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'" title="Add Event" class="addevt">'.$addevtimg.'</a>]'; } $this->calWeekDays .= " ".$this->makeDayEventListHTML()."</td>\n"; $this->weekDayNum++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw_calendar($month,$year,$events = array()){\n\t\t$dayofweek = array('<td class=\"calendar-header\">Sunday</td>',\n\t\t'<td class=\"calendar-header\">Monday</td>',\n\t\t'<td class=\"calendar-header\">Tuesday</td>',\n\t\t'<td class=\"calendar-header\">Wednesday</td>',\n\t\t'<td class=\"calendar-header\">Thursday</td>',\n\t\t'<td class=\"calendar-header\">Friday</td>',\n\t\t'<td class=\"calendar-header\">Saturday</td>');\n\t\t\n\t\t/* draw table\n\t\t\t- fill top row with array using implode */\n\t\t$calendar = '<table class=\"calendar\"><tr class=\"calendar-row\">'.implode($dayofweek).'</tr>';\n\t\t\n\t\t// mktime(hour,minute,second,month,day,year);\n\t\t// figures out the which day of the week 1st is based on provided $month and $year\n\t\t$startDay = date('w',mktime(0,0,0,$month,1,$year)); // return days of the week\n\t\t$days = cal_days_in_month(CAL_GREGORIAN,$month,$year);\n\t\t$daysFilled;\n\t\t$counter = 0;\n\t\n\t\t/* row 2 */\n\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\n\t\t/* print \"blank\" days until the first of the month */\n\t\tfor($i = 0; $i < $startDay; $i++){\n\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\t$daysFilled++;\n\t\t}\n\t\n\t\t/* for loop to add days */\n\t\tfor($i = 1; $i <= $days; $i++):\n\t\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\"><div class=\"date\">'.$i.'</div>';\n\t\t\t\n\t\t\tif ($i < 10){\n\t\t\t\t$i = \"0\".$i;\n\t\t\t}\n\t\t\t\n\t\t\t// input event into calendar\n\t\t\t$eventDay = $year.'-'.$month.'-'.$i;\n\t\t\t\tif(isset($events[$eventDay])) { // if there are events on $eventDay\n\t\t\t\t\tforeach($events[$eventDay] as $eventid) { // for each event, add to calendar\n\t\t\t\t\t\t$mysql = new mysql();\n\t\t\t\t\t\t$tripdetail = $mysql->get_specifictrip($eventid);\n\t\t\t\t\t\t$calendar.= '<div class=\"event\"';\n\t\t\t\t\t\tif($tripdetail[approval]==0){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#FF6666;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($tripdetail[approval]==-1){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#6666E0; text-decoration:line-through;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$calendar.='><a style=\"text-decoration:none; color:inherit;\" href=\"?page=detail2&trip='.$tripdetail[eventid].'\"';\n\t\t\t\t\t\t$calendar.='>'.$tripdetail[destination].'</div>';\n\t\t\t\t\t}\n\t\t\t\t\t$calendar.='</td>';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\t$calendar.= '<p> </p><p> </p></div></td>';\n\t\t\t\t}\n\n\t\t\tif($startDay == 6){ // if the month starts on Saturday, end current row\n\t\t\t\t$calendar.= '</tr>';\n\t\t\t\tif(($counter+1) != $days){ // if there are still days left to fill, new row\n\t\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\t}\n\t\t\t\t$startDay = -1;\n\t\t\t\t$daysFilled = 0;\n\t\t\t}\n\t\t\t$daysFilled++;\n\t\t\t$startDay++;\n\t\t\t$counter++;\n\t\tendfor;\n\t\n\t\t// finish filling in the rest of the days with blanks\n\t\tif($daysFilled < 8 && $daysFilled !=1):\n\t\t\tfor($x = 1; $x <= (8 - $daysFilled); $x++):\n\t\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\tendfor;\n\t\tendif;\n\t\n\t\t// end row, table\n\t\t$calendar.= '</tr></table>';\n\t\t\n\t\t\n\t\t// return HTML code for calendar\n\t\treturn $calendar;\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 }", "function build_month_days($month, $number_of_days) {\r\n $days_of_month_html = '<tr class=\"week-day\">';\r\n \r\n $days_in_week = 1;\r\n for ($days = 1; $days <= $number_of_days; $days++) {\r\n\r\n // Split the weeks in rows\r\n if ($days_in_week == 8) {\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n $days_of_month_html = $days_of_month_html . '<tr class=\"week-day\">'; \r\n $days_in_week = 1;\r\n }\r\n\r\n // Render days of week in the correct position\r\n if ($days == 1) {\r\n $initial_position = get_first_day($month);\r\n for($i = 1; $i < $initial_position; $i++) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\"></td>';\r\n $days_in_week++;\r\n }\r\n if ($initial_position == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>';\r\n }\r\n } else if ($days_in_week == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>'; \r\n }\r\n\r\n $days_in_week++;\r\n }\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n \r\n return $days_of_month_html;\r\n }", "public function buildCalendarList(){\n\t\t\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'list';\n\t\t\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\" class=\"calendar_list\">\n <?php echo $this->buildCalendarHead() ?>\n <tr>\n <td>\n <?php \n /*** CURRENT MONTH CELLS ***/\n $first_day = $this->getYear() . '-' . $this->getMonth() . '-01';\n $last_day = $this->getYear() . '-' . $this->getMonth() . '-' . $current_number_of_days;\n \n $object = $this->events_ob;\n $month_events = new $object();\n $month_events = $month_events->fetchAll(\"WHERE DATE(\" . $this->events_end_date_field . \") >= '\" . $first_day . \"' AND DATE(\" . $this->events_end_date_field . \") <= '\" . $last_day . \"'\", \"ORDER BY `\" . $this->events_end_date_field . \"` DESC\");\n \n if(count($month_events) > 0){\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n \n $events = $this->buildDayList($full_date);\t//get events for each day\n if(strlen(trim($events))){\n ?>\n <div class=\"day\">\n <?php echo $events; ?>\n </div>\n <?php\n }\n }\n }\n else{?>\n \t\t<h5><?php echo 'No events in ' . $this->getMonthName() . ' ' . $this->getYear();?></h5>\n <?php\n }\n ?> \n </td>\n </tr>\n </table>\n <?php\n return ob_get_clean();\n\t}", "function build_calendar($month,$year,$dateArray) {\r\n $daysOfWeek = array('S','M','T','W','T','F','S');\r\n\r\n // What is the first day of the month in question?\r\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\r\n\r\n // How many days does this month contain?\r\n $numberDays = date('t',$firstDayOfMonth);\r\n\r\n // Retrieve some information about the first day of the\r\n // month in question.\r\n $dateComponents = getdate($firstDayOfMonth);\r\n\r\n // What is the name of the month in question?\r\n $monthName = $dateComponents['month'];\r\n\r\n // What is the index value (0-6) of the first day of the\r\n // month in question.\r\n $dayOfWeek = $dateComponents['wday'];\r\n\r\n // Create the table tag opener and day headers\r\n\r\n $calendar = \"<table class='table table-bordered'>\";\r\n $calendar .= \"<caption>$monthName $year</caption>\";\r\n $calendar .= \"<tr>\";\r\n\r\n // Create the calendar headers\r\n\r\n foreach($daysOfWeek as $day) {\r\n $calendar .= \"<th class='header'>$day</th>\";\r\n } \r\n\r\n // Create the rest of the calendar\r\n\r\n // Initiate the day counter, starting with the 1st.\r\n\r\n $currentDay = 1;\r\n\r\n $calendar .= \"</tr><tr>\";\r\n\r\n // The variable $dayOfWeek is used to\r\n // ensure that the calendar\r\n // display consists of exactly 7 columns.\r\n\r\n if ($dayOfWeek > 0) { \r\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\"; \r\n }\r\n \r\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\r\n \r\n while ($currentDay <= $numberDays) {\r\n\r\n // Seventh column (Saturday) reached. Start a new row.\r\n\r\n if ($dayOfWeek == 7) {\r\n\r\n $dayOfWeek = 0;\r\n $calendar .= \"</tr><tr>\";\r\n\r\n }\r\n \r\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\r\n \r\n $date = \"$year-$month-$currentDayRel\";\r\n\t\tif($date == date('Y-m-d')){\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date' bgcolor='#ADD8E6'>$currentDay<br/>\";\r\n\t\t}else{\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date'>$currentDay<br/>\";\r\n\t\t}\r\n \r\n\t\t $sql = mysql_query(\"SELECT * FROM leavesys.leave_details WHERE date = '\".$date.\"'\");\r\n\t\t while($result = mysql_fetch_array($sql)){\r\n\t\t\t $sql2 = mysql_query(\"SELECT * FROM user WHERE id = '\".$result['applicant_id'].\"'\");\r\n\t\t\t $result2 = mysql_fetch_assoc($sql2);\r\n\t\t\t\tif($result['half'] == 1){\r\n\t\t\t\t\t$c_content = \" (am)\";\r\n\t\t\t\t}else if($result['half'] == 2){\r\n\t\t\t\t\t$c_content = \" (pm)\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$c_content = \"\";\r\n\t\t\t\t}\r\n\t\t\t\t$calendar .= $result2['country_code'].\" - \".$result2['name'].$c_content.\"<br/>\";\r\n\t\t }\r\n\t\t $sql1 = mysql_query(\"SELECT * FROM leavesys.holiday WHERE date = '\".$date.\"'\");\r\n\t\t while($result1 = mysql_fetch_array($sql1)){\r\n\t\t\t if($result1['country'] == \"al\"){\r\n\t\t\t\t $calendar .= \"<font color='blue;'>\".$result1['name'].\"</font><br/>\";\r\n\t\t\t }else{\r\n\t\t\t\t$calendar .= \"<font color='blue;'>\".$result1['name'].\" (\".$result1['country'].\")</font><br/>\";\r\n\t\t\t }\r\n\t\t }\r\n\t\t $calendar .= \"</td>\";\r\n\r\n // Increment counters\r\n \r\n $currentDay++;\r\n $dayOfWeek++;\r\n\r\n }\r\n \r\n \r\n\r\n // Complete the row of the last week in month, if necessary\r\n\r\n if ($dayOfWeek != 7) { \r\n \r\n $remainingDays = 7 - $dayOfWeek;\r\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\"; \r\n\r\n }\r\n \r\n $calendar .= \"</tr>\";\r\n\r\n $calendar .= \"</table>\";\r\n\r\n return $calendar;\r\n\r\n}", "function display_day()\n{\n global $phpcid, $phpc_cal, $phpc_script, $phpcdb, $day, $month, $year;\n\n\t$monthname = month_name($month);\n\n $results = $phpcdb->get_occurrences_by_date($phpcid, $year, $month, $day);\n\n\t$have_events = false;\n\n\t$html_table = tag('table', attributes('class=\"phpc-main\"'),\n\t\t\ttag('caption', \"$day $monthname $year\"),\n\t\t\ttag('thead',\n\t\t\t\ttag('tr',\n\t\t\t\t\ttag('th', __('Title')),\n\t\t\t\t\ttag('th', __('Time')),\n\t\t\t\t\ttag('th', __('Description'))\n\t\t\t\t )));\n\tif($phpc_cal->can_modify()) {\n\t\t$html_table->add(tag('tfoot',\n\t\t\t\t\ttag('tr',\n\t\t\t\t\t\ttag('td',\n\t\t\t\t\t\t\tattributes('colspan=\"4\"'),\n\t\t\t\t\t\t\tcreate_hidden('action', 'event_delete'),\n\t\t\t\t\t\t\tcreate_hidden('day', $day),\n\t\t\t\t\t\t\tcreate_hidden('month', $month),\n\t\t\t\t\t\t\tcreate_hidden('year', $year),\n\t\t\t\t\t\t\tcreate_submit(__('Delete Selected'))))));\n\t}\n\n\t$html_body = tag('tbody');\n\n\twhile($row = $results->fetch_assoc()) {\n\t\n\t\t$event = new PhpcOccurrence($row);\n\n\t\tif(!$event->can_read())\n\t\t\tcontinue;\n\n\t\t$have_events = true;\n\n\t\t$eid = $event->get_eid();\n\t\t$oid = $event->get_oid();\n\n\t\t$html_subject = tag('td');\n\n\t\tif($event->can_modify()) {\n\t\t\t$html_subject->add(create_checkbox('eid[]',\n\t\t\t\t\t\t$eid));\n\t\t}\n\n\t\t$html_subject->add(create_occurrence_link(tag('strong',\n\t\t\t\t\t\t$event->get_subject()),\n\t\t\t\t\t'display_event', $oid));\n\n\t\tif($event->can_modify()) {\n\t\t\t$html_subject->add(\" (\");\n\t\t\t$html_subject->add(create_event_link(\n\t\t\t\t\t\t__('Modify'), 'event_form',\n\t\t\t\t\t\t$eid));\n\t\t\t$html_subject->add(')');\n\t\t}\n\n\t\t$html_body->add(tag('tr',\n\t\t\t\t\t$html_subject,\n\t\t\t\t\ttag('td', $event->get_time_span_string()),\n\t\t\t\t\ttag('td', attributes('class=\"phpc-desc\"'), $event->get_desc())));\n\t}\n\n\t$html_table->add($html_body);\n\n\tif($phpc_cal->can_modify()) {\n\t\t$output = tag('form',\n\t\t\t\tattributes(\"action=\\\"$phpc_script\\\"\"),\n\t\t\t\t$html_table);\n\t} else {\n\t\t$output = $html_table;\n\t}\n\n\tif(!$have_events)\n\t\t$output = tag('h2', __('No events on this day.'));\n\n\treturn tag('', create_day_menu(), $output);\n}", "function build_calendar($month,$year,$dateArray) {\n $daysOfWeek = array('S','M','T','W','T','F','S');\n\n // What is the first day of the month in question?\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\n\n // How many days does this month contain?\n $numberDays = date('t',$firstDayOfMonth);\n\n // Retrieve some information about the first day of the\n // month in question.\n $dateComponents = getdate($firstDayOfMonth);\n\n // What is the name of the month in question?\n $monthName = $dateComponents['month'];\n\n // What is the index value (0-6) of the first day of the\n // month in question.\n $dayOfWeek = $dateComponents['wday'];\n\n // Create the table tag opener and day headers\n\n $calendar = \"<table class='calendar'>\";\n $calendar .= \"<caption>$monthName $year</caption>\";\n $calendar .= \"<tr>\";\n\n // Create the calendar headers\n\n foreach($daysOfWeek as $day) {\n $calendar .= \"<th class='header'>$day</th>\";\n }\n\n // Create the rest of the calendar\n\n // Initiate the day counter, starting with the 1st.\n\n $currentDay = 1;\n\n $calendar .= \"</tr><tr>\";\n\n // The variable $dayOfWeek is used to\n // ensure that the calendar\n // display consists of exactly 7 columns.\n\n if ($dayOfWeek > 0) {\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\";\n }\n\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\n\n while ($currentDay <= $numberDays) {\n\n // Seventh column (Saturday) reached. Start a new row.\n\n if ($dayOfWeek == 7) {\n\n $dayOfWeek = 0;\n $calendar .= \"</tr><tr>\";\n\n }\n\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\n\n $date = \"$year-$month-$currentDayRel\";\n\n $calendar .= \"<td class='day' rel='$date'>$currentDay</td>\";\n\n // Increment counters\n\n $currentDay++;\n $dayOfWeek++;\n\n }\n\n\n\n // Complete the row of the last week in month, if necessary\n\n if ($dayOfWeek != 7) {\n\n $remainingDays = 7 - $dayOfWeek;\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\";\n\n }\n\n $calendar .= \"</tr>\";\n\n $calendar .= \"</table>\";\n\n return $calendar;\n\n}", "function draw_calendar($month,$year){\r\n\t/*Naredi koledar*/\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\t\r\n\t$headings = array('Nedelja','Ponedeljek','Torek','Sreda','Cetrtek','Petek','Sobota');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\tif($list_day < 10) {\r\n $list_day = str_pad($list_day, 2, '0', STR_PAD_LEFT);\r\n }\r\n\t\t$month = str_pad($month, 2, '0', STR_PAD_LEFT);\r\n\t\t$event_day = $year.'-'.$month.'-'.$list_day;\r\n\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div name=\"test\" style=\"height:100px; width:120px; overflow: auto; white-space:nowrap\" id=' .$event_day. ' onclick=\"modal(this.id);\">';\r\n\t\t$calendar.= '<div>'.$list_day.'</div>';\t\r\n\t\t$query = \"SELECT CONCAT_WS(' ',s.firstname,s.lastname) as Zaposleni, a.name, aa.aktivnost_id\r\n\t\t\tFROM ost_staff s, ost_agent_aktivnost aa, ost_aktivnosti a\r\n\t\t\tWHERE s.staff_id = aa.staff_id and a.id=aa.aktivnost_id and '$event_day' BETWEEN aa.aktivnost_od AND aa.aktivnost_do AND aa.aktivnost_id > 1 AND aa.aktivnost_id != 9 AND aa.aktivnost_id != 10\";\r\n\t\t\t$result = db_query($query) or die('Ne morem pridobiti rezultata!');\r\n\t\t\twhile($row = db_fetch_array($result)) {\r\n\t\t\t\t$words = explode(' ',$row['Zaposleni']);\r\n\t\t\t\t$calendar .= '<div>'.$words[0][0].'. '.$words[1][0].'. : '.$row['name'].'</div>';\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t$calendar.= '</tr>';\r\n\r\n\t$calendar.= '</table>';\r\n\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\r\n\treturn $calendar;\r\n}", "private function buildBodyDay()\n {\n\n $events = $this->events;\n $h = \"\";\n for ($i = $this->start_hour; $i < $this->end_hour; $i++) {\n for ($t = 0; $t < 2; $t++) {\n $h .= \"<tr>\";\n $min = $t == 0 ? \":00\" : \":30\";\n $h .= \"<td class='$this->timeClass'>\" . date('g:ia', strtotime($i . $min)) . \"</td>\";\n for ($k = 0; $k < 1; $k++) {\n $wd = $this->week_days[$k];\n $time_r = $this->year . '-' . $this->month . '-' . $wd . ' ' . $i . ':00:00';\n $min = $t == 0 ? '' : '+30 minute';\n $time_1 = strtotime($time_r . $min);\n $time_2 = strtotime(date('Y-m-d H:i:s', $time_1) . '+30 minute');\n $dt = date('Y-m-d H:i:s', $time_1);\n $h .= \"<td colspan='3' data-datetime='$dt'>\";\n $h .= $this->dateWrap[0];\n\n $hasEvent = false;\n foreach ($events as $key => $event) {\n //EVENT TIME AND DATE\n $time_e = strtotime($key);\n if ($time_e >= $time_1 && $time_e < $time_2) {\n $hasEvent = true;\n $h .= $this->buildEvents(false, $event);\n }\n }\n $h .= !$hasEvent ? '&nbsp;' : '';\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n $h .= \"</tr>\";\n }\n }\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n\n $this->html .= $h;\n }", "function drawCalendar($month, $year) {\n $first = mktime(0,0,0,$month,1,$year); // timestamp for first of the month\n $offset = date('w', $first); // what day of the week we start counting on\n $daysInMonth = date('t', $first);\n $monthName = date('F', $first);\n $weekDays = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');\n $eventDays = getEventDays($month, $year);\n \n // Start drawing calendar\n $out = \"<table id=\\\"myCalendar\\\">\\n\";\n $out .= \"<tr><th colspan=\\\"3\\\">$monthName $year</th></tr>\\n\";\n $out .= \"<tr>\";\n foreach ($weekDays as $wd) $out .= \"<td class=\\\"weekDays\\\">$wd</td>\\n\";\n\n\n // Previous month link\n $prevTS = strtotime(\"$year-$month-01 -1 month\"); // timestamp of the first of last month\n $pMax = date('t', $prevTS);\n $pDay = ($day > $pMax) ? $pMax : $day;\n list($y, $m) = explode('-', date('Y-m', $prevTS)); \n $pMax = date('t', $prevTS);\n $pDay = ($day > $pMax) ? $pMax : $day;\n list($y, $m) = explode('-', date('Y-m', $prevTS));\n echo \"<p>\";\n echo \"<a href=\\\"?year=$year&month=$m&day=$pDay\\\"><< Prev</a>\\n\";\n\n // Next month link\n $nextTS = strtotime(\"$year-$month-01 +1 month\");\n $nMax = date('t', $nextTS);\n $nDay = ($day > $nMax) ? $nMax : $day;\n list($y, $m) = explode('-', date('Y-m', $nextTS));\n echo \"<a href=\\\"?year=$y&month=$m&day=$nDay\\\">Next >></a>\\n\";\n echo \"</p>\";\n\n\n // Build Previous and Next Links from untitled-6\n //$previous_link = \"<a href=\\\"\".$_SERVER['PHP_SELF'].\"?date=\";\n //if($month == 1){\n // $previous_link .= mktime(0,0,0,12,$day,($year -1));\n //} else {\n // $previous_link .= mktime(0,0,0,($month -1),$day,$year);\n //}\n\n //$previous_link .= \"\\\"><< </a>\";\n\n //$next_link = \"<a href=\\\"\".$_SERVER['PHP_SELF'].\"?date=\";\n //if($month == 12){\n // $next_link .= mktime(0,0,0,1,$day,($year + 1));\n //} else {\n // $next_link .= mktime(0,0,0,($month +1),$day,$year);\n //}\n //$next_link .= \"\\\"> >></a>\";\n\n $i = 0;\n for ($d = (1 - $offset); $d <= $daysInMonth; $d++) {\n if ($i % 7 == 0) $out .= \"<tr>\\n\"; // Start new row\n if ($d < 1) $out .= \"<td class=\\\"nonMonthDay\\\"> </td>\\n\";\n else {\n if (in_array($d, $eventDays)) {\n $out .= \"<td class=\\\"monthDay\\\">\\n\";\n $out .= \"<a href=\\\"?year=$year&month=$month&day=$d\\\">$d</a>\\n\";\n $out .= \"</td>\\n\";\n } else $out .= \"<td class=\\\"monthDay\\\">$d</td>\\n\";\n }\n ++$i; // Increment position counter\n if ($i % 7 == 0) $out .= \"</tr>\\n\"; // End row on the 7th day\n }\n \n // Round out last row if we don't have a full week\n if ($i % 7 != 0) {\n for ($j = 0; $j < (7 - ($i % 7)); $j++) {\n $out .= \"<td class=\\\"nonMonthDay\\\"> </td>\\n\";\n }\n $out .= \"</tr>\\n\";\n }\n \n $out .= \"</table>\\n\";\n \n return $out;\n }", "public function buildCalendar(){\n\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'calendar';\n\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\">\n <?php echo $this->buildCalendarHead() ?>\n <tr id=\"events_calendar_weekdays\">\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Sunday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Sun</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">S</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Monday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Mon</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">M</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Tuesday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Tue</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">T</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Wednesday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Wed</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">W</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Thursday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Thu</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">T</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Friday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Fri</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">F</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Saturday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Sat</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">S</div>\n </th>\n </tr>\n <?php\n $dayCounter = 0;\t\t\t\t\t\t\t\t\t\t\t//Keeps count of the days in a week\n\n /*** PREVIOUS MONTH CELLS ***/\n for($day = $number_of_previous_days; $day >= 1; $day--){\t//For each day in the previous month needed for a full week\n $dayNumber = $prev_month_number_of_days - ($day-1);\t\t\n \n //Get full date (YYYY-MM-DD)\n $year = ($this->getPrevMonth() == 12)? ($this->getYear()-1): $this->getYear();\n $full_date = $year . '-' . $this->getPrevMonth() . '-' . $dayNumber;\n \n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n \n echo $this->buildCalendarCell($full_date, $dayNumber, 'prev_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n\n /*** CURRENT MONTH CELLS ***/\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n\n echo $this->buildCalendarCell($full_date, $day, 'current_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n\n /*** NEXT MONTH CELLS ***/\n for($day = 1; $day <= $dayCounter; $day++){\t//For each day in the current month\n //Get full date (YYYY-MM-DD)\n $year = ($this->getNextMonth() == 1)? ($this->getYear()+1): $this->getYear();\n $full_date = $year . '-' . $this->getNextMonth() . '-' . $day;\n \n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n\n echo $this->buildCalendarCell($full_date, $day, 'next_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n ?>\n </table>\n <style>\n\t\t\t<?php \n\t\t\tforeach($this->getCategories() as $c){?>\n\t\t\t#events_calendar .event.category_<?php echo $c->getId(); ?>:before{color: <?php echo $c->getColor(); ?> !important;}\n\t\t\t<?php } ?>\n\t\t</style>\n <?php\n\t\treturn ob_get_clean();\n\t}", "function draw_calendar($month,$year,$cal,$available_list,$price_list){\n\n /* draw table */\n $calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n /* table headings */\n $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n $calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n $dates_array = array();\n\n /* row for week one */\n $calendar.= '<tr class=\"calendar-row\">';\n\n /* print \"blank\" days until the first of the current week */\n for($x = 0; $x < $running_day; $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n $days_in_this_week++;\n endfor;\n\n /* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n // echo \" cal: \".($available_list[$list_day - 1] == 't').\"\\n\";\n if ($available_list[$list_day - 1] == 't')\n {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#00FF00\">';\n } else {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#FF0000\">';\n\n }\n \n\n /* add in the day number */\n $calendar.= '<div class=\"day-number\" ><font size=\"+3\">'.$list_day.\"</font> \".$price_list[$list_day-1].'</div>';\n\n /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n $calendar.= str_repeat('<p> </p>',2);\n \n $calendar.= '</td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n endfor;\n\n /* finish the rest of the days in the week */\n if($days_in_this_week < 8):\n for($x = 1; $x <= (8 - $days_in_this_week); $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n endfor;\n endif;\n\n /* final row */\n $calendar.= '</tr>';\n\n /* end the table */\n $calendar.= '</table>';\n \n /* all done, return result */\n return $calendar;\n }", "function MakeCalendarGrid(){\n //get our days\n $intMonthDays = cal_days_in_month(CAL_GREGORIAN, $this->intMonth, $this->intYear);\n $intDayCounter = 0;\n $arrMonthAttributes = array('colspan'=>'7');\n //make our parent calendar table\n $objCalendarParent = $this->objCalendar->AddChildNode($this->objCalendar->objHTML,'', 'table');\n //let's make our header\n $objHeaderRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n //establish our base attributes\n for($intWeekDay=0;$intWeekDay<7;$intWeekDay++){\n $strDay = date('l', strtotime(\"Sunday +{$intWeekDay} days\"));\n $this->objCalendar->AddChildNode($objHeaderRow,$strDay, 'th',array('class'=>'weekday'));\n }\n //get the starting date\n $intMonthStart = date('N', strtotime($this->intYear.'-'.$this->intMonth.'-1'));\n $intMonthStart++;\n //avoid empty rows\n if($intMonthStart == 8)\n $intMonthStart = 1;\n //make our days now\n for($intDay=1;$intDay<($intMonthDays + $intMonthStart);$intDay++){\n $arrDateAttributes = array('onclick'=>'SelectDay(this);');\n if($intDayCounter === 0){\n //make our new week\n $objWeekRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n $arrDateAttributes['class'] = 'calendarday weekend';\n }\n else if($intDayCounter === 6)\n $arrDateAttributes['class'] = 'calendarday weekend';\n else if($intDay == date('j'))\n $arrDateAttributes['class'] = 'calendarday today';\n else\n $arrDateAttributes['class'] = 'calendarday weekday';\n $intDayCounter++;\n //reset our week now\n if($intDayCounter == 7)\n $intDayCounter = 0;\n if($intDay < $intMonthStart){\n unset($arrDateAttributes['onclick']);\n $this->objCalendar->AddChildNode($objWeekRow,'&nbsp;', 'td',$arrDateAttributes);\n continue 1;\n }\n $arrDateAttributes['id'] = ($intDay - ($intMonthStart - 1)).'-'.$this->arrCalendarProperties['calendarid'];\n //make our day now\n $this->objCalendar->AddChildNode($objWeekRow,($intDay - ($intMonthStart - 1)), 'td',$arrDateAttributes);\n }\n return TRUE;\n }", "public static function day_calendar($day, $month, $year) {\r\n global $langNoEvents, $langDay, $langWeek, $langMonth, $langViewShow;\r\n\r\n $calendar_content = \"\";\r\n if (is_null($day)) {\r\n $day = 1;\r\n }\r\n $nextdaydate = new DateTime(\"$year-$month-$day\");\r\n $nextdaydate->add(new DateInterval('P1D'));\r\n $previousdaydate = new DateTime(\"$year-$month-$day\");\r\n $previousdaydate->sub(new DateInterval('P1D'));\r\n\r\n $thisday = new DateTime(\"$year-$month-$day\");\r\n $daydescription = ucfirst(format_locale_date($thisday->getTimestamp()));\r\n\r\n $backward = array('day'=>$previousdaydate->format('d'), 'month'=>$previousdaydate->format('m'), 'year' => $previousdaydate->format('Y'));\r\n $foreward = array('day'=>$nextdaydate->format('d'), 'month'=>$nextdaydate->format('m'), 'year' => $nextdaydate->format('Y'));\r\n\r\n $calendar_content .= '<div class=\"right\" style=\"width:100%\">'.$langViewShow.':&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_day(selectedday, selectedmonth, selectedyear);return false;\">'.$langDay.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_week(selectedday, selectedmonth, selectedyear);return false;\">'.$langWeek.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_month(selectedday, selectedmonth, selectedyear);return false;\">'.$langMonth.'</a></div>';\r\n\r\n $calendar_content .= \"<table class='table-default'>\";\r\n $calendar_content .= \"<tr>\";\r\n $calendar_content .= '<td width=\"25\"><a href=\"#\" onclick=\"show_day('.$backward['day'].','.$backward['month'].','.$backward['year'].'); return false;\">&laquo;</a></td>';\r\n $calendar_content .= \"<td class='center'><b>$daydescription</b></td>\";\r\n $calendar_content .= '<td width=\"25\" class=\"right\"><a href=\"#\" onclick=\"show_day('.$foreward['day'].','.$foreward['month'].','.$foreward['year'].'); return false;\">&raquo;</a></td>';\r\n $calendar_content .= \"</tr>\";\r\n $calendar_content .= \"</table>\";\r\n\r\n $eventlist = Calendar_Events::get_calendar_events(\"day\", \"$year-$month-$day\");\r\n $calendar_content .= \"<table class='table-default'>\";\r\n\r\n $curhour = 0;\r\n $now = getdate();\r\n $today = new DateTime($now['year'].'-'.$now['mon'].'-'.$now['mday'].' '.$now['hours'].':'.$now['minutes']);\r\n if ($now['year'].'-'.$now['mon'].'-'.$now['mday'] == \"$year-$month-$day\") {\r\n $thisdayistoday = true;\r\n }\r\n else{\r\n $thisdayistoday = false;\r\n }\r\n $thishour = new DateTime($today->format('Y-m-d H:00'));\r\n $cursorhour = new DateTime(\"$year-$month-$day 00:00\");\r\n $curstarthour = \"\";\r\n\r\n foreach ($eventlist as $thisevent) {\r\n $thiseventstart = new DateTime($thisevent->start);\r\n $thiseventhour = new DateTime($thiseventstart->format('Y-m-d H:00'));\r\n if ($curstarthour != $thiseventhour) { //event date changed\r\n while($cursorhour < $thiseventhour) {\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($cursorhour->format('H:i')) . \"</b></td></tr>\";\r\n if (intval($cursorhour->diff($thiseventhour,true)->format('%h'))>6) {\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n }\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n $curhour += 6;\r\n }\r\n\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n //No hour tr for the event\r\n //$calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($thiseventhour->format('H:i')) . \"</b></td></tr>\";\r\n if ($cursorhour <= $thiseventhour) {\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n $curhour += 6;\r\n }\r\n }\r\n $calendar_content .= Calendar_Events::day_calendar_item($thisevent, 'even');\r\n $curstarthour = $thiseventhour;\r\n }\r\n /* Fill with empty days*/\r\n for($i=$curhour;$i<24;$i+=6) {\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($cursorhour->format('H:i')) . \"</b></td></tr>\";\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n }\r\n $calendar_content .= \"</table>\";\r\n /* Legend */\r\n $calendar_content .= Calendar_Events::calendar_legend();\r\n\r\n return $calendar_content;\r\n }", "function draw_calendar($month,$year){\n\n\t\t/* draw table */\n\t\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t\t/* table headings */\n\t\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t\t/* days and weeks vars now ... */\n\t\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t\t$days_in_this_week = 1;\n\t\t$day_counter = 0;\n\t\t$dates_array = array();\n\n\t\t/* row for week one */\n\t\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t\t/* print \"blank\" days until the first of the current week */\n\t\tfor($x = 0; $x < $running_day; $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t\t$days_in_this_week++;\n\t\tendfor;\n\n\t\t/* keep going with days.... */\n\t\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t\t$calendar.= '<td class=\"calendar-day\"><a href=\"appointments.php?day=' . $list_day . '&month=' . $GLOBALS['curMonth'] . '&year=' . $GLOBALS['curYear'] . '\">';\n\t\t\t\t/* add in the day number */\n\t\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n\n\t\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t\t$calendar.= str_repeat('<p> </p>',2);\n\t\t\t\t\n\t\t\t$calendar.= '</a></td>';\n\t\t\tif($running_day == 6):\n\t\t\t\t$calendar.= '</tr>';\n\t\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\tendif;\n\t\t\t\t$running_day = -1;\n\t\t\t\t$days_in_this_week = 0;\n\t\t\tendif;\n\t\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\t\tendfor;\n\n\t\t/* finish the rest of the days in the week */\n\t\tif($days_in_this_week < 8):\n\t\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t\tendfor;\n\t\tendif;\n\n\t\t/* final row */\n\t\t$calendar.= '</tr>';\n\n\t\t/* end the table */\n\t\t$calendar.= '</table>';\n\t\t\n\t\t/* all done, return result */\n\t\treturn $calendar;\n\t}", "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}", "function draw_calendar($month,$year,$activityStartDateArray = array()){\r\n\r\n\t/* draw table */\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\r\n\t/* table headings */\r\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t/* days and weeks vars now ... */\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t/* row for week one */\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\t/* print \"blank\" days until the first of the current week */\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\t/* keep going with days.... */\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\">';\r\n\t\t\t/* add in the day number */\r\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\r\n\t\t\t\r\n\t\t\t//eventdate=startdate and enddate, depends which we talks about \r\n\r\n\t\t\t$startDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\t//$endDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\techo \"<br>the start date is\".$startDate;\r\n\t\t\t//something is wrong wit hteh startDate, the origin code has a while loop in the beginning, think why \r\n\t\t\t\r\n\t\t\tif(isset($activityStartDateArray[$startDate])) {\r\n\t\t\t\tforeach($activityStartDateArray[$startDate] as $activity) {\r\n\t\t\t\t\t$calendar.= '<div class=\"activity\">'.$activity['activityName'].'</div>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\telse {\r\n\t\t\t\t$calendar.= str_repeat('<p>&nbsp;</p>',2);\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\t\r\n\t\r\n\t/* finish the rest of the days in the week */\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t/* final row */\r\n\t$calendar.= '</tr>';\r\n\t\r\n\r\n\t/* end the table */\r\n\t$calendar.= '</table>';\r\n\r\n\t/** DEBUG **/\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\t\r\n\t/* all done, return result */\r\n\treturn $calendar;\r\n}", "private function buildBody()\n {\n $day = 1;\n $now_date = $this->year . '-' . $this->month . '-01';\n $startingDay = date('N', strtotime('first day of this month', strtotime($now_date)));\n //Add the following line if you want to start the week with monday instead of sunday. Or change the number to suit your needs.\n //$startingDay = $startingDay - 1;\n $monthLength = $this->daysMonth[$this->month - 1];\n if ($this->month == 2 && ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)))) {\n $monthLength = $monthLength + 1;\n }\n $h = \"<tr>\";\n for ($i = $startingDay == 7 ? 1 : 0; $i < 9; $i++) {\n for ($j = 0; $j <= 6; $j++) {\n $currDate = $this->getDayDate($day);\n $class = $this->getTdClass($day);\n $h .= \"<td data-datetime='$currDate' $class>\";\n $h .= $this->dateWrap[0];\n if ($day <= $monthLength && ($i > 0 || $j >= $startingDay)) {\n $h .= $this->dayWrap[0];\n $h .= $this->getEventSearchLink($day);\n $h .= $this->dayWrap[1];\n $h .= $this->buildEvents($currDate);\n $day++;\n } else {\n $h .= \"&nbsp;\";\n }\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n // stop making rows if we've run out of days\n if ($day > $monthLength) {\n break;\n } else {\n $h .= \"</tr>\";\n $h .= \"<tr>\";\n }\n }\n $h .= \"</tr>\";\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n $this->html .= $h;\n }", "public static function month_calendar($day, $month, $year) {\r\n global $langDay_of_weekNames, $langMonthNames, $langToday, $langDay, $langWeek, $langMonth, $langViewShow;\r\n\r\n $calendar_content = \"\";\r\n //Handle leap year\r\n $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);\r\n if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {\r\n $numberofdays[2] = 29;\r\n }\r\n\r\n $eventlist = Calendar_Events::get_calendar_events(\"month\", \"$year-$month-$day\");\r\n\r\n $events = array();\r\n if ($eventlist) {\r\n foreach ($eventlist as $event) {\r\n $eventday = new DateTime($event->startdate);\r\n $eventday = $eventday->format('j');\r\n if (!array_key_exists($eventday,$events)) {\r\n $events[$eventday] = array();\r\n }\r\n array_push($events[$eventday], $event);\r\n }\r\n }\r\n\r\n //Get the first day of the month\r\n $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));\r\n //Start the week on monday\r\n $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;\r\n\r\n $backward = array('month'=>$month == 1 ? 12 : $month - 1, 'year' => $month == 1 ? $year - 1 : $year);\r\n $foreward = array('month'=>$month == 12 ? 1 : $month + 1, 'year' => $month == 12 ? $year + 1 : $year);\r\n\r\n $calendar_content .= '<div class=\"right\" style=\"width:100%\">'.$langViewShow.':&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_day(selectedday, selectedmonth, selectedyear);return false;\">'.$langDay.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_week(selectedday, selectedmonth, selectedyear);return false;\">'.$langWeek.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_month(selectedday, selectedmonth, selectedyear);return false;\">'.$langMonth.'</a></div>';\r\n\r\n $calendar_content .= '<table width=100% class=\"title1\">';\r\n $calendar_content .= \"<tr>\";\r\n $calendar_content .= '<td width=\"250\"><a href=\"#\" onclick=\"show_month(1,'.$backward['month'].','.$backward['year'].'); return false;\">&laquo;</a></td>';\r\n $calendar_content .= \"<td class='center'><b>{$langMonthNames['long'][$month-1]} $year</b></td>\";\r\n $calendar_content .= '<td width=\"250\" class=\"right\"><a href=\"#\" onclick=\"show_month(1,'.$foreward['month'].','.$foreward['year'].'); return false;\">&raquo;</a></td>';\r\n $calendar_content .= \"</tr>\";\r\n $calendar_content .= \"</table><br />\";\r\n $calendar_content .= \"<table class='table-default'><tr class='list-header'>\";\r\n for ($ii = 1; $ii < 8; $ii++) {\r\n $calendar_content .= \"<th class='text-center'>\" . $langDay_of_weekNames['long'][$ii % 7] . \"</th>\";\r\n }\r\n $calendar_content .= \"</tr>\";\r\n $curday = -1;\r\n $today = getdate();\r\n\r\n while ($curday <= $numberofdays[$month]) {\r\n $calendar_content .= \"<tr>\";\r\n\r\n for ($ii = 0; $ii < 7; $ii++) {\r\n if (($curday == -1) && ($ii == $startdayofweek)) {\r\n $curday = 1;\r\n }\r\n if (($curday > 0) && ($curday <= $numberofdays[$month])) {\r\n $bgcolor = $ii < 5 ? \"class='alert alert-danger'\" : \"class='odd'\";\r\n $dayheader = \"$curday\";\r\n $class_style = \"class=odd\";\r\n if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {\r\n $dayheader = \"<b>$curday</b> <small>($langToday)</small>\";\r\n $class_style = \"class='today'\";\r\n }\r\n $calendar_content .= \"<td height=50 width=14% valign=top $class_style><b>$dayheader</b>\";\r\n $thisDayItems = \"\";\r\n if (array_key_exists($curday, $events)) {\r\n foreach ($events[$curday] as $ev) {\r\n $thisDayItems .= Calendar_Events::month_calendar_item($ev, Calendar_Events::$calsettings->{$ev->event_group.\"_color\"});\r\n }\r\n $calendar_content .= \"$thisDayItems</td>\";\r\n }\r\n $curday++;\r\n } else {\r\n $calendar_content .= \"<td width=14%>&nbsp;</td>\";\r\n }\r\n }\r\n $calendar_content .= \"</tr>\";\r\n }\r\n $calendar_content .= \"</table>\";\r\n\r\n /* Legend */\r\n $calendar_content .= Calendar_Events::calendar_legend();\r\n\r\n\r\n /*************************************** Bootstrap calendar ******************************************************/\r\n\r\n $calendar_content .= '<div id=\"bootstrapcalendar\"></div>';\r\n\r\n return $calendar_content;\r\n }", "private function makeArrayIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\t\t\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'normalDay';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'weekendDay';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'currentDay';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t} \n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['dayname'] = $this->daysArray[$this->weekDayNum - 1];\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['weekdaynumber'] = $this->weekDayNum;\n\t\t\t\t\t\t\t\t\t\n\t\t\t// Draw days\n\t\t\tif($this->makeDayEventListArray()) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['events'] = $this->makeDayEventListArray();\n\t\t\t}\n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['datestamp'] = $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth;\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "function calendar($date) {\r\n\t //If no parameter is passed use the current date.\r\n\t if($date == null)\r\n\t $date = getDate();\r\n\r\n\t $day \t\t\t= $date[\"mday\"];\r\n\t $month \t\t= $date[\"mon\"];\r\n\t $month_name \t= $date[\"month\"];\r\n\t $year \t\t\t= $date[\"year\"];\r\n\r\n\t $this_month \t= getDate(mktime(0, 0, 0, $month, 1, $year));\r\n\t $next_month \t= getDate(mktime(0, 0, 0, $month + 1, 1, $year));\r\n\r\n\t //Find out when this month starts and ends.\r\n\t $first_week_day = $this_month[\"wday\"];\r\n\t $days_in_this_month = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));\r\n\r\n\t $calendar_html = \"<table width='100%'>\";\r\n\t $calendar_html = $calendar_html.\"<tr>\t<td class='perp_report_header' colspan='7' /> Month: \".$month_name.\" / Year: \".$year.\"</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\";\r\n\t $calendar_html = $calendar_html.\"<tr>\t<td class='perp_report_subheader'>Sunday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Monday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Tuesday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Wednesday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Thursday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Friday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td class='perp_report_subheader'>Saterday</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t\t\t<tr>\";\r\n\r\n\t// Fill the first week of the month with the appropriate number of blanks.\r\n\t\t\t$gapcounter = 0;\r\n\t\t\tfor($week_day = 0; $week_day < $first_week_day; $week_day++) {\r\n\t\t\t\t\t$gapcounter = $gapcounter + 1;\r\n\t\t\t\t}\r\n\t\t\t$calendar_html = $calendar_html.\"<td class='perp_report_cell' colspan='\".$gapcounter.\"'></td>\";\t\r\n\t\r\n\t// Draw Calendar Elements\r\n\t\t\t// I forget!\t\t\t\t\r\n\t $week_day = $first_week_day;\r\n\t for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++) {\r\n\t\t\t\t\t// Determine Day of the week\r\n\t\t\t\t\t$week_day %= 7;\r\n\t\t\t\t\r\n\t\t\t\t\t// If this variable equals 0, we will need to start a new row.\r\n\t\t\t\t\tif($week_day == 0) {\r\n\t\t\t\t\t\t\t$calendar_html = $calendar_html.\"</tr><tr>\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$datetopull = $year.\"/\".$month.\"/\".$day_counter;\r\n\t\t\t\t\t$innercell = \"<TABLE width='100%' style='margin-bottom:0;margin-top:0;'><tr><td class='perp_report_fieldname'>Date:</td><td class='perp_report_fieldcontent'>\".$datetopull.\"</td></tr>\";\r\n\t\t\t\t\t//Now Get inspection List for this day.....\r\n\t\t\t\t\t$objconn = mysqli_connect($GLOBALS['hostdomain'], $GLOBALS['hostusername'], $GLOBALS['passwordofdatabase'], $GLOBALS['nameofdatabase']);\t\t\t\t\t\r\n\t\t\t\t\tif (mysqli_connect_errno()) {\r\n\t\t\t\t\t\t\t// there was an error trying to connect to the mysql database\r\n\t\t\t\t\t\t\t//printf(\"connect failed: %s\\n\", mysqli_connect_error());\r\n\t\t\t\t\t\t\texit();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t$sql = \"SELECT * FROM tbl_139_337_main WHERE 139337_date = '\".$datetopull.\"' ORDER BY 139337_time\";\r\n\t\t\t\t\t\t\t//echo \"The SQL Statement is :\".$sql.\"<br>\";\r\n\t\t\t\t\t\t\t$objrs = mysqli_query($objconn, $sql);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($objrs) {\r\n\t\t\t\t\t\t\t\t\t$number_of_rows = mysqli_num_rows($objrs);\r\n\t\t\t\t\t\t\t\t\twhile ($objarray = mysqli_fetch_array($objrs, MYSQLI_ASSOC)) {\r\n\t\t\t\t\t\t\t\t\t\t$counter = $counter + 1;\r\n\t\t\t\t\t\t\t\t\t\t\t$counter = $counter + 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// So the Archieved or Duplicate Narrowing...\r\n\t\t\t\t\t\t\t\t\t\t\t$displayrow\t\t\t\t\t= 0;\r\n\t\t\t\t\t\t\t\t\t\t\t$displayrow_a\t\t\t\t= 0;\r\n\t\t\t\t\t\t\t\t\t\t\t$displayrow_b\t\t\t\t= 0;\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t$tmpdiscrepancyid\t\t\t= $objarray['Discrepancy_id'];\r\n\t\t\t\t\t\t\t\t\t\t\t$tmpdiscrepancycondition\t= $objarray['discrepancy_checklist_id'];\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t$displayrow_a\t\t\t\t= preflights_tbl_139_337_main_a_yn($tmpdiscrepancyid,0); // 0 will not return a row even if it is archieved.\r\n\t\t\t\t\t\t\t\t\t\t\t//$displayrow_d\t\t\t\t= preflights_tbl_139_327_main_sub_d_d_yn($tmpdiscrepancyid,0); // 0 will not return a row even if it is duplicate.\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif($displayrow_a == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$displayrow = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($displayrow_d == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$displayrow = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\tif($displayrow_d == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$displayrow = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($displayrow_a == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$displayrow = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\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\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tif ($displayrow == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$innercell = $innercell.\"<tr>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<form style='margin-bottom:0;' action='part139337_report_display.php' method='POST' name='reportform' id='reportform' target='WLHMWindow' onsubmit='window.open('', 'WLHMWindow', 'width=800,height=600,status=no,resizable=no,scrollbars=yes')'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan='2' class='formoptionsubmit'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='recordid'\tID='recordid' \t\t\tvalue=\".$tmpdiscrepancyid.\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='submit' value='D:\".$tmpdiscrepancyid.\"' name='b1' ID='b1' class='makebuttonlooklikelargetext' style='width:100%;'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</form>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\";\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t$innercell = $innercell.\"</table>\";\t\r\n\t\t\t\t\tif ($counter == 0) {\r\n\t\t\t\t\t\t\t$innercell = $innercell.\"Nothing Reported\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t$calendar_html = $calendar_html.\"<td align=\\\"center\\\" valign='top' class='perp_report_activecell'>&nbsp;\".$innercell.\"</td>\";\r\n\t\t\t\t\t$week_day++;\r\n\t\t\t\t\t$counter = 0;\r\n\t\t\t\t}\r\n\r\n\t $calendar_html .= \"</tr>\";\r\n\t $calendar_html .= \"</table>\";\r\n\r\n\t return($calendar_html);\r\n\t }", "function draw_calendar_activ($month,$year){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');\n\t$calendar.= '<tr class=\"calendar-row-day\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++){\n\t\t$calendar.= '<td class=\"calendar-day\">';\n\t\t\t/* add in the day number */\n $ddate = $year.\"-\".$month.\"-\".sprintf(\"%02d\", $list_day);\n $newdatabal = sprintf(\"%02d\", $list_day);\n $qq = mysql_query(\"SELECT * FROM reserver WHERE date_deb LIKE('$ddate%')\")or die(mysql_error());\n\n if(mysql_num_rows($qq) >0){\n $newblabla = $ddate.\"<br>\n <a href='afres.php?y=\".$year.\"&m=\".$month.\"&d=\".$newdatabal.\"' target='_blank' style='color: #302C87; text-decoration: none'> Il y'a : \".mysql_num_rows($qq).' reservation(s)</a>';\n }else{\n $newblabla = $ddate.\"<br>no reservations\";\n }\n\t\t\t$calendar.= '<div class=\"day-number\">\n\n '.$newblabla;\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t$calendar.= str_repeat('<p> </p>',2);\n\n\t\t$calendar.= '</td>';\n\t\tif($running_day == 6):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\tendif;\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\n\n\t}\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\n\t/* all done, return result */\n\treturn $calendar;\n\n\n}", "protected function compileWeeks()\n\t{\n\t\t$intDaysInMonth = date('t', $this->Date->monthBegin);\n\t\t$intFirstDayOffset = date('w', $this->Date->monthBegin) - $this->cal_startDay;\n\n\t\tif ($intFirstDayOffset < 0)\n\t\t{\n\t\t\t$intFirstDayOffset += 7;\n\t\t}\n\n\t\t$intColumnCount = -1;\n\t\t$intNumberOfRows = ceil(($intDaysInMonth + $intFirstDayOffset) / 7);\n\t\t$arrAllEvents = $this->getAllEvents($this->iso_arrEventIDs, $this->cal_calendar, $this->Date->monthBegin, $this->Date->monthEnd);\n\t\t\n\t\t$arrDays = array();\n\n\t\t// Compile days\n\t\tfor ($i=1; $i<=($intNumberOfRows * 7); $i++)\n\t\t{\n\t\t\t$intWeek = floor(++$intColumnCount / 7);\n\t\t\t$intDay = $i - $intFirstDayOffset;\n\t\t\t$intCurrentDay = ($i + $this->cal_startDay) % 7;\n\n\t\t\t$strWeekClass = 'week_' . $intWeek;\n\t\t\t$strWeekClass .= ($intWeek == 0) ? ' first' : '';\n\t\t\t$strWeekClass .= ($intWeek == ($intNumberOfRows - 1)) ? ' last' : '';\n\n\t\t\t$strClass = ($intCurrentDay < 2) ? ' weekend' : '';\n\t\t\t$strClass .= ($i == 1 || $i == 8 || $i == 15 || $i == 22 || $i == 29 || $i == 36) ? ' col_first' : '';\n\t\t\t$strClass .= ($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) ? ' col_last' : '';\n\n\t\t\t// Empty cell\n\t\t\tif ($intDay < 1 || $intDay > $intDaysInMonth)\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = '&nbsp;';\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days empty' . $strClass ;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$intKey = date('Ym', $this->Date->tstamp) . ((strlen($intDay) < 2) ? '0' . $intDay : $intDay);\n\t\t\t$strClass .= ($intKey == date('Ymd')) ? ' today' : '';\n\n\t\t\t// Mark the selected day (see #1784)\n\t\t\tif ($intKey == $this->Input->get('day'))\n\t\t\t{\n\t\t\t\t$strClass .= ' selected';\n\t\t\t}\n\n\t\t\t// Inactive days\n\t\t\tif (empty($intKey) || !isset($arrAllEvents[$intKey]))\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days' . $strClass;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$arrEvents = array();\n\n\t\t\t// Get all events of a day\n\t\t\tforeach ($arrAllEvents[$intKey] as $v)\n\t\t\t{\n\t\t\t\tforeach ($v as $vv)\n\t\t\t\t{\n\t\t\t\t\t$arrEvents[] = $vv;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days active' . $strClass;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['href'] = $this->strUrl . ($GLOBALS['TL_CONFIG']['disableAlias'] ? '?id=' . $this->Input->get('id') . '&amp;' : '?') . 'day=' . $intKey;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['title'] = sprintf(specialchars($GLOBALS['TL_LANG']['MSC']['cal_events']), count($arrEvents));\n\t\t\t$arrDays[$strWeekClass][$i]['events'] = $arrEvents;\n\t\t}\n\n\t\treturn $arrDays;\n\t}", "function output_calendar() // Generating calendar HTML content\r\n\t{\r\n\t\t# Apparently, it's not possible to dereference $this->callback()\r\n\t\t$cb = $this->callback;\r\n\r\n\t\t# Preliminary calculations\r\n\t\t$t = getdate(strtotime($this->date));\r\n\t\t$today = $t[\"mday\"];\r\n\t\t$year = $t[\"year\"];\r\n\t\t$month = $t[\"mon\"];\r\n\t\t# Get first day of the month (monday = 0)\r\n\t\t$first_wday = ((int) date(\"w\", mktime(0, 0, 0, $month, 1, $year))+6)%7;\r\n\t\t# Last day of the month\r\n\t\t$last_mday = (int) date(\"d\", mktime(0, 0, 0, $month+1, 0, $year));\r\n\r\n\t\t# Anchor\r\n\t\t//$this->content[].=\"<a name=\\\"calendar\\\">\";\r\n\r\n\t\t# Table\r\n\t\t$this->content[].=\"<table width=\\\"100%\\\" align=\\\"center\\\" cellpadding=\\\"0\\\" cellspacing=\\\"2\\\" class=\\\"calendar\\\">\\n\";\r\n\r\n\t\t# Table head\r\n\t\t$this->content[].=\"<tr><td colspan=\\\"7\\\" class=\\\"calendar_header\\\">{$this->month_name[$month - 1]}&nbsp;&nbsp;&nbsp;{$t['year']}</td></tr>\\n<tr>\\n\";\r\n\t\tfor ($j = 0;$j <= 6;$j++) {\r\n\t\t\t$this->content[].=\"<th class=\\\"calendar_title\\\">\";\r\n\t\t\t$this->content[].=\"{$this->day_name[$j]}\";\r\n\t\t\t$this->content[].=\"</th>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</tr>\\n\";\r\n\r\n\t\t// Day row\r\n\t\t// A month is displayed on 6 rows\r\n\t\t// except for a 28 days month starting on Monday\r\n\t\tif (($last_mday == 28) and ($first_wday == 0))\r\n\t\t$jmax = 27;\r\n\t\telse\r\n\t\t$jmax = 41;\r\n\r\n\t\tfor ($j = 0;$j <= $jmax;$j++) {\r\n\t\t\t# Start new row on Monday\r\n\t\t\tif ($j % 7 == 0)\r\n\t\t\t$this->content[].=\"<tr>\\n\";\r\n\r\n\t\t\t// Title colour for current day and checking week end days\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 == 6)) // if today and weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title_we\\\">\";\r\n\r\n\t\t\tif (($j % 7 == 6) and ($j != $today+$first_wday-1)) // if weekend day and not today\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day_we\\\">\";\r\n\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 != 6)) // if today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title\\\">\";\r\n\r\n\t\t\tif (($j % 7 != 6) and ($j != $today+$first_wday-1)) // if not today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day\\\">\";\r\n\r\n\t\t\tif (($j<$first_wday) or ($j>=$last_mday + $first_wday)) {\r\n\r\n\t\t\t\t# Empty boxes\r\n\t\t\t\t$this->content[].=\"&nbsp;\";\r\n\t\t\t} else {\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\techo $cb(mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\t$this->content[].=date($this->date_format, mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\t$this->content[].=\"</a>\\n\";\r\n\t\t\t}\r\n\t\t\t$this->content[].=\"</td>\\n\";\r\n\r\n\t\t\t# End of row on Sunday\r\n\t\t\tif ($j % 7 == 6)\r\n\t\t\t$this->content[].=\"</tr>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</table>\\n\";\r\n\t}", "function displayCurrentMonthCalenderAsTable()\n{\nglobal $year; // this year\nglobal $month; // this month\nglobal $id;\n$day=1; // start from first of month\nglobal $crypted;\nglobal $month_caption; // caption to table\n$lastmonth = $month - 1;\n$nextmonth = $month +1;\n$lastyear = $year - 1;\n$nextyear = $year + 1;\necho \"<table summary=\\\"Monthly calendar\\\" onMouseover= changeto('#CCCCCC') onMouseout= changeback('white') width = 757 cellspacing= 2 cellpadding= 2 id= ignore class=\\\"sk_bok_green\\\">\n<caption ><a href=comm.php?crypted=$_GET[crypted]&calender&lastyear=$lastyear ><font color=green>Last Year</font></a>&nbsp;&nbsp;&nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&last=$lastmonth&year=$year><font color=green>Last Month</a>&nbsp;&nbsp;&nbsp; <b>[$month_caption ]</b> &nbsp;&nbsp;&nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&next=$nextmonth&year=$year><font color= green>Next Month</font></a> &nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&lastyear=$nextyear><font color= green>Next Year<font></a></caption>\n<tr align=center id=ignore>\n<th width =308 id=ignore bgcolor=#FFC56C ><font color =Red>Sun</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Mon</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Tue</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Wed</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Thu</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Fri</font></th> \n<th width =308 id=ignore bgcolor=#FFC56C><font color =blue>Sat</font></th> \n</tr>\\n\"; \n\n$ts = mktime(0,0,0,$month,$day,$year); // unix timestamp of the first day of current month\n$weekday_first_day = date(\"w\",$ts); // which is the weekday of the first day of week 0-Sunday 6-Saturday\n//$my_format = date(\"d-m-Y\");\n$slot=0;\n\nprint \"<tr align=center >\\n\"; // First row starts\nfor($i=0;$i<$weekday_first_day;$i++) // Pad the first few rows(slots)\n{\nprint \" <td id=ignore width =308></td>\"; // Empty slots \n$slot++;\n}\n\tif($day == '')\n\t{\n\t\t$ig = 'ignore';\n\t\techo \">>\";\n\t}\n\nwhile(checkdate($month,$day,$year) && $date<32) // till there are valid days in current month\n{\nif($slot == 7) // if we moved past saturday\n{\n$slot = 0; // reset and move back to sunday\nprint \"</tr>\\n\"; // end of this row\nprint \"<tr align=center width =50>\\n\"; // move on to next row\n\n}\n\t//$system_date = '$day-$month-$year';\n\t//$db_date = date('d-m-Y',$day $month $year);\n\t$system_date = mktime(0, 0, 0, $month, $day, $year);\n\t$db_date = date('d-m-Y',$system_date);\n\t$db_date_search = explode('-',$db_date);\n\t//print_r($db_date_search);\n\t$search_date = mktime(0, 0, 0, $month, $day);\n\t$search_date = sprintf(date('d-m-',$search_date));\n\t$month_no = $db_date_search[1];\n\t $query =\"select * from calender_event where active = '1' and day = '$db_date_search[0]' and `month_no` = '$month_no' and year = '$db_date_search[2]' \";\n\t\n\t$result = mysql_query($query) or die(mysql_error());\n\t$count = mysql_num_rows($result);\n\t/* echo $query;\n\techo $count; */\n\t$tr = 0;\n\t\n\tif($count != '0')\n\t{\t$msg .= \"<table id=ignore width=100%>\";\n\t\twhile($row=mysql_fetch_array($result))\n\t\t{\n\t\t\n\t\tif($row[popup] =='1')\n\t\t{\n\t\t\t$popup_link = \" onmouseout=\\\"hideTooltip()\\\" onmouseover=\\\"showTooltip(event,'$row[pop_msg]'\";\n\t\t\n\t\t}else\n\t\t{\n\t\t\t$popup_link =\"\";\n\t\t}\n\t\t\n\t\t$msg .= \"<tr ><td id=ignore bgcolor=green>$row[heading]</td></tr><tr><td id=ignore bgcolor=white><a href=\\\"comm.php?crypted=$_GET[crypted]&last=$month_no&year=$db_date_search[2]&calender&edit_event=$row[sno]\\\" $popup_link);return false\\\">$row[details]</a></td></tr>\";\n\t\t}\n\t\t$msg .= \"</table>\";\n\t}else\n\t{\n\t\t$msg ='';\n\t\n\t}\n\t//chking all db\n\t$color = \"bgcolor = white\";\n\techo \"<td $color id=$idd width =308 hight=308><DIV align=center id= tips><a href = #><font color=black><a href=comm.php?crypted=$_GET[crypted]&last=$month_no&year=$db_date_search[2]&calender&add_event=$db_date_search[0]-$db_date_search[1]-$db_date_search[2]>$day</a> </font>\n\t\t\n\t\t \";\n\t\n\t\n\t\techo \"</div ></a>$msg</div ></td>\";\n$msg ='';\n\t\n\n$day++;\n$slot++;\n}\n\nif($slot>0) // have we started off a new last row \n{\nwhile($slot<7) // padding at the end to complete the last row table\n{\nprint \" <td id=ignore></td>\"; // empty slots\n$slot++;\n}\nprint \"\\n</tr>\\n\"; // close out last row\n}\nprint '</table>'; //end of table\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 draw_calendar($year)\n {\n $calendar.= '<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\">\n <title>Calendar</title>\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n <style>\n #today {\n background-color: lightgreen;\n }\n .day-number {\n text-align: center;\n }\n .calendar-week {\n width: 14%;\n text-align: center;\n }\n .container {\n text-align: center;\n }\n .col-centered{\n float: none;\n margin: 0 auto;\n }\n </style>\n </head>\n <body>';\n date_default_timezone_set(\"America/New_York\");\n $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');\n for ($month = 1; $month <= 12; $month++)\n {\n //create header\n $header = '<h2>'.$months[$month-1].' '.$year.'</h2>';\n $calendar.= '<div class=\"row\"><div class=\"container col-xs-6 col-centered\"> <table class=\"table table-bordered\">';\n \n \t// write calendar table headings \n \t$headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');\n \t$calendar.= $header.'<tr><td class=\"calendar-week\">'.implode('</td><td class=\"calendar-week\">',$headings).'</td></tr>';\n \n \t$starting_day = date('w', mktime(0, 0, 0, $month, 1, $year)); //the starting day of the week\n \t$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));\n \t$days_this_week = 1;\n \t$day_counter = 0;\n \t$end_of_month = 0;\n \n \t// row for week one \n \t$calendar.= '<tr>';\n \t\n \t// display blank days until starting day of the current week\n \tfor($day = 0; $day < $starting_day; $day++):\n \t\t$calendar.= '<td> </td>';\n \t\t$days_this_week++; //add blank day to days\n \tendfor;\n \n \t// write days\n \tfor ($day = 1; $day <= $days_in_month; $day++):\n \t\tif ($day != date('d') && $month != date('n'))\n \t\t{\n \t\t\t$current_day = ''; //add blank td per day (that isnt today)\n \t\t}\n \t\t$calendar.= '<td class=\"calendar-day'.$current_day.'\">';\n \t\t\n \t\t\t// Add in the day number\n if ($day == date('d') && $month == date('n') && $year == date('Y')) //this day = today\n \t\t\t{\n \t\t\t\t$showtoday = '<div id=\"today\"> <strong>'.$day.'</strong></div>'; //add today (special styling)\n \t\t\t}else {\n \t\t\t $showtoday = $day;\n \t\t\t}\n \t\t\t$calendar.= '<div class=\"day-number\">'.$showtoday.'</div>'; //commit the date number to the td\n \n \t\t// end of first week\n \t\t$calendar.= '</td>';\n \t\tif($starting_day == 6):\n \t\t\t$calendar.= '</tr>'; // if end of week, end row\n \t\t\tif (($day_counter+1) != $days_in_month) //if today is not end of month, start new row\n \t\t\t{\n \t\t\t\t$calendar.= '<tr>';\n \t\t\t} else \n \t\t\t{\n \t\t\t $end_of_month = 1; // is end of month, so no need for new row\n \t\t\t}\n \t\t\t$starting_day = -1; // if end of week, mark as sunday-1 so when incrementing below, it goes to 0 (sunday)\n \t\t\t$days_this_week = 0; //reset days this week\n \t\tendif;\n \t\t$days_this_week++;\n \t\t$starting_day++;\n \t\t$day_counter++;\n \tendfor;\n \n \t// Finish the rest of blank days in the week\n \tif(($days_this_week < 8) && ($end_of_month == 0)): //last row of calendar, if end of month already has happened (ie on the last day of the previous week), do not add new cells\n \t\tfor($x = 1; $x <= (8 - $days_this_week); $x++):\n \t\t\t$calendar.= '<td> </td>';\n \t\tendfor;\n \tendif;\n \n \t// final row\n \t$calendar.= '</tr>';\n \n \t// end table tags\n \t$calendar.= '</table> </div> </div>';\n }\n // end tags and return\n $calendar.= '</body>\n </html>';\n return $calendar;\n }", "function draw_calendar($month,$year, $userID, $type, $dbhandle){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t$calendar.= '<td class=\"calendar-day\">';\n\t\t\n\t\t\t//Alert count for this day\n\t\t\t$dateString = '20'.$year.'-'.$month.'-';\n\t\t\tif( $list_day < 10 )\n\t\t\t\t$dateString .= \"0\".$list_day;\n\t\t\telse\n\t\t\t\t$dateString .= $list_day;\n\t\t\t\t\n\t\t\t\n\t\t\t$alertSql = \"select `Date`, Description from Alerts where SubjectID=$userID and Seen=0 and CAST(`Date` AS DATE)='\".$dateString.\"';\";\n\t\t\t$alertResult = $dbhandle->query($alertSql);\n\t\t\t$alertCount = $alertResult->num_rows;\n\t\t\tif( $alertCount > 0 )\n\t\t\t{\n\t\t\t\t$calendar.= '<div><b><a href=\"../Main/Alerts.php?user='.$userID.'&date='.$dateString.'\" style=\"color:red\">'.$alertCount.'</a></b></div>';\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t/* add in the day number */\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.' </div>';\n\t\t\t\n\t\t\t$dayStr = \"\";\n\t\t\tif($type == \"Session\")\n\t\t\t{\n\t\t\t\t$dayAfter = $list_day+1;\n\t\t\t\t$startTime = \"$year-$month-$list_day\";//date(\"Y-m-d\n\t\t\t\t$endtTime = \"\";\n\t\t\t\t//Deal with days/months carrying over\n\t\t\t\tif( $dayAfter > $days_in_month )\t//Check that the day after wont be more than there is in the month\n\t\t\t\t{\n\t\t\t\t\tif( $month == 12 )\n\t\t\t\t\t\t$endtTime = ($year+1) .\"-01-01\";\n\t\t\t\t\telse\n\t\t\t\t\t\t$endtTime = \"$year-\". ($month+1) .\"-01\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$endtTime = \"$year-$month-$dayAfter\";\n\t\t\t\t}\n\t\t\t\t//$calendar.= '<div>'.$endtTime.'</div>';\n\t\t\t\t\t\n\t\t\t\t$sql = \"SELECT SessionID, WingmanPlayed, CyclingPlayed, TargetsPlayed, DATE_FORMAT(StartTime,'%H:%i') as Start, DATE_FORMAT(EndTime,'%H:%i') as End FROM Session WHERE UserID = $userID AND (StartTime > '$startTime' AND EndTime < '$endtTime' AND EndTime <> 0 )\";\n\t\t\t\t$result = $dbhandle->query($sql);\n\t\t\t\tif ($result->num_rows > 0) {\n\t\t\t\t\t// output data of each row\n\t\t\t\t\twhile($row = $result->fetch_assoc()) {\n\t\t\t\t\t\t$sess = $row[\"SessionID\"];\n\t\t\t\t\t\t$start = $row[\"Start\"];\n\t\t\t\t\t\t$end = $row[\"End\"];\n\t\t\t\t\t\tif($dayStr != \"\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$dayStr .= \"<br />\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ($row['WingmanPlayed'] > 0 && $row['TargetsPlayed'] > 0 )\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:red'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Wingman (Elbow Raise) & Targets (Arm Extension)'>$start-$end</a>\";\n }\n \n else if ($row['TargetsPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:green'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Targets (Arm Extension)'>$start-$end</a>\";\n }\n else if ($row['WingmanPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:blue'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Wingman (Elbow Raise)'>$start-$end</a>\";\n } \n\t\t\t\t\t\t\t\t\t\t\t\t\t else if ($row['CyclingPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:purple'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Cycling (Elbow Raise)'>$start-$end</a>\";\n } \n\t\t\t\t\t\telse\n {\n \n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t$calendar.= \"<p>$dayStr</p>\";\n\t\t\t\n\t\t$calendar.= '</td>';\n\t\tif($running_day == 6):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\tendif;\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\tendfor;\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\t\n\t/* all done, return result */\n\treturn $calendar;\n}", "function print_calendar($mon,$year)\n\t{\n\t\tglobal $dates, $first_day, $start_day;\n\t\t\t$cellWidth =\"150\";\n\t\t$first_day = mktime(0,0,0,$mon,1,$year);\n\t\t$start_day = date(\"w\",$first_day);\n\t\t$res = getdate($first_day);\n\t\t$month_name = $res[\"month\"];\n\t\t$no_days_in_month = date(\"t\",$first_day);\n\t\t\n\t\t//If month's first day does not start with first Sunday, fill table cell with a space\n\t\tfor ($i = 1; $i <= $start_day;$i++)\n\t\t\t$dates[1][$i] = \" \";\n\n\t\t$row = 1;\n\t\t$col = $start_day+1;\n\t\t$num = 1;\n\t\twhile($num<=31)\n\t\t\t{\n\t\t\t\tif ($num > $no_days_in_month)\n\t\t\t\t\t break;\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$dates[$row][$col] = $num;\n\t\t\t\t\t\tif (($col + 1) > 7)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$row++;\n\t\t\t\t\t\t\t\t$col = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$col++;\n\t\t\t\t\t\t$num++;\n\t\t\t\t\t}//if-else\n\t\t\t}//while\n\t\t$mon_num = date(\"n\",$first_day);\n\t\t$temp_yr = $next_yr = $prev_yr = $year;\n\n\t\t$prev = $mon_num - 1;\n\t\t$next = $mon_num + 1;\n\n\t\t//If January is currently displayed, month previous is December of previous year\n\t\tif ($mon_num == 1)\n\t\t\t{\n\t\t\t\t$prev_yr = $year - 1;\n\t\t\t\t$prev = 12;\n\t\t\t}\n \n\t\t//If December is currently displayed, month next is January of next year\n\t\tif ($mon_num == 12)\n\t\t\t{\n\t\t\t\t$next_yr = $year + 1;\n\t\t\t\t$next = 1;\n\t\t\t}\n\n\t\techo \"<DIV ALIGN='center'><TABLE BORDER=1 WIDTH=1600px CELLSPACING=0 BORDERCOLOR='silver'>\";\n\n\t\techo \t\"\\n<TR ALIGN='center'><TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$prev&year=$prev_yr' STYLE=\\\"text-decoration: none\\\"><B><<</B></A> </TD>\".\n\t\t\t \"<TD COLSPAN=5 BGCOLOR='#99CCFF'><B>\".date(\"F\",$first_day).\" \".$temp_yr.\"</B></TD>\".\n\t\t\t \"<TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$next&year=$next_yr' STYLE=\\\"text-decoration: none\\\"><B>>></B></A> </TD></TR>\";\n\n\t\techo \"\\n<TR ALIGN='center'><TD width='$cellWidth'><B>Domenica</B></TD><TD width='$cellWidth'><B>Lunedi</B></TD><TD width='$cellWidth'><B>Martedi</B></TD>\";\n\t\techo \"<TD width='$cellWidth'><B>Mercoledi</B></TD><TD width='$cellWidth'><B>Giovedi</B></TD><TD width='$cellWidth'><B>Venerdi</B></TD><TD width='$cellWidth'><B>Sabato</B></TD></TR>\";\n\t\techo \"<TR><TD COLSPAN=7> </TR><TR height='100px;' ALIGN='center'>\";\n\t\t\t\t\n\t\t$end = ($start_day > 4)? 6:5;\n\t\tfor ($row=1;$row<=$end;$row++)\n\t\t\t{\n\t\t\t\tfor ($col=1;$col<=7;$col++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($dates[$row][$col] == \"\")\n\t\t\t\t\t\t$dates[$row][$col] = \" \";\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!strcmp($dates[$row][$col],\" \"))\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$t = $dates[$row][$col];\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//If date is today, highlight it\n\t\t\t\t\t\tif (($t == date(\"j\")) && ($mon == date(\"n\")) && ($year == date(\"Y\"))){\n\t\t\t\t\t\t\techo \"\\n<TD valign='top' BGCOLOR='aqua'><a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\";\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n }\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t//If the date is absent ie after 31, print space\n\t\t\t\t\t\t\techo \"\\n<TD valign='top'>\".(($t == \" \" )? \"&nbsp;\" : \"<a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\");\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n\t\t\t\t\t }\n }// for -col\n\t\t\t\t\n\t\t\t\tif (($row + 1) != ($end+1))\n\t\t\t\t\techo \"</TR>\\n<TR ALIGN='center' height='100px;'>\";\n\t\t\t\telse\n\t\t\t\t\techo \"</TR>\";\n\t\t\t}// for - row\n\t\techo \"\\n</TABLE><BR><BR><A HREF=\\\"index.php\\\">Visualizza mese corrente</A> </DIV>\";\n\t}", "function mkDays ($numDays, $month, $year) {\n for ($i = 1; $i <= $numDays; $i++) {\n $eachDay[$i] = $i; \n }\n foreach($eachDay as $day => &$wkday) {\n $wkday = date(\"w\", mktime(0,0,0,$month,$day,$year));\n }\n foreach($eachDay as $day=>&$wkday) {\n echo \"<table class='box' id=$day month=$month year=$year>\";\n echo \"<td>\";\n echo $day;\n echo \"</td>\";\n echo \"</table>\";\n }\n }" ]
[ "0.72028095", "0.71000516", "0.70803356", "0.70312774", "0.70239383", "0.6909667", "0.690769", "0.6813331", "0.6793757", "0.67725843", "0.67438596", "0.67350274", "0.6697026", "0.6695359", "0.6692827", "0.6680418", "0.6673593", "0.6642261", "0.65114194", "0.6481101", "0.64571977", "0.64270306", "0.63422596", "0.6319139", "0.63151604", "0.6296179", "0.62815744", "0.6277548", "0.626166", "0.62555176" ]
0.7805902
0
Iterate calendar days (Array version) Loop through calendar days for the given month and create a large multidimensional array of all the elements required to draw the calendar.
private function makeArrayIterator() { $this->weekDayNum = $this->firstDayOfTheMonth+1; for($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) { // Set the default style $this->outArray['days'][$this->dayOfMonth]['style'] = 'normalDay'; // Set the style to a weekend day style if(($this->weekDayNum == 8)||($this->weekDayNum == 7)) { $this->outArray['days'][$this->dayOfMonth]['style'] = 'weekendDay'; } // Set the style to a current day style if($this->curDay == $this->dayOfMonth) { $this->outArray['days'][$this->dayOfMonth]['style'] = 'currentDay'; } // If the current day is Sunday, add a new row if($this->weekDayNum == 8) { $this->weekDayNum = 1; } $this->outArray['days'][$this->dayOfMonth]['dayname'] = $this->daysArray[$this->weekDayNum - 1]; $this->outArray['days'][$this->dayOfMonth]['weekdaynumber'] = $this->weekDayNum; // Draw days if($this->makeDayEventListArray()) { $this->outArray['days'][$this->dayOfMonth]['events'] = $this->makeDayEventListArray(); } $this->outArray['days'][$this->dayOfMonth]['datestamp'] = $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth; $this->weekDayNum++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _getDaysArray($month, $year = 0)\n {\n if ($year == 0)\n {\n $year = $this->year;\n }\n\n $days = array();\n\n // Return everyday of the month if both bit[2] and bit[4] are '*'\n if ($this->bits[2] == '*' AND $this->bits[4] == '*')\n {\n $days = $this->_getDays($month, $year);\n }\n else\n {\n // Create an array for the weekdays\n if (substr($this->bits[4], 0, 1) == '*')\n {\n if (substr($this->bits[4], 1, 1) == '/')\n {\n $step = (int) substr($this->bits[4], 2);\n }\n else\n {\n $step = 1;\n }\n \n for ($i = 0; $i <= 6; $i += $step)\n {\n $arWeekdays[] = $i;\n }\n }\n else\n {\n $arWeekdays = $this->_expandRanges($this->bits[4]);\n $arWeekdays = $this->_sanitize($arWeekdays, 0, 7);\n\n // Map 7 to 0, both represents Sunday. Array is sorted already!\n if (in_array(7, $arWeekdays))\n {\n if (in_array(0, $arWeekdays))\n {\n array_pop($arWeekdays);\n }\n else\n {\n $tmp[] = 0;\n array_pop($arWeekdays);\n $arWeekdays = array_merge($tmp, $arWeekdays);\n }\n }\n }\n\n if ($this->bits[2] == '*')\n {\n $daysmonth = $this->_getDays($month, $year);\n }\n else\n {\n $daysmonth = $this->_expandRanges($this->bits[2]);\n\n // So that we do not end up with 31 of Feb\n $daysInMonth = $this->_daysInMonth($month, $year);\n $daysmonth = $this->_sanitize($daysmonth, 1, $daysInMonth);\n }\n\n // Now match these days with weekdays\n foreach ($daysmonth AS $day)\n {\n $wkday = date('w', mktime(0, 0, 0, $month, $day, $year));\n if (in_array($wkday, $arWeekdays))\n {\n $days[] = $day;\n }\n }\n }\n\n return $days;\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}", "public function getDaysAsArray()\n {\n $days = [];\n $startCurrent = $this->weekdayIndexes[$this->currentMonth[\"weekday\"]];\n $startPrevious = $this->noOfDaysPrevious - ($startCurrent - 1);\n // Add days of previous month\n for ($i = $startPrevious; $i <= $this->noOfDaysPrevious; $i++) {\n $days[] = $i;\n }\n // Add days of current month\n for ($j = 1; $j <= $this->noOfDays; $j++) {\n $days[] = $j;\n }\n // Add days of next month\n for ($k = 1; count($days) % 7 !== 0; $k++) {\n $days[] = $k;\n }\n return $days;\n }", "function create_calendar_array($used_dates){\n\n\t//create array of dates for October with false attributes\n\t$october = array();\n\tfor($day=1;$day<=31;$day++){\n\t\t$october[$day]=FALSE;\n\t}\n\t\n\t//compare used dates to whole month\n\tforeach\t($used_dates as $post_id=>$date){\n\t\t$october[intval($date['day'])][]=$post_id;\n\t}\n\t\t\n\t\n\treturn $october;\n}", "protected function getDaysArray($month, $year)\n\t{\n\t\t$daysinmonth = $this->days_in_month($month, $year);\n\t\t$domStar = false;\n\t\t$dowStar = false;\n\t\t$da = array_pad([], $daysinmonth + 1, null);\n\t\tunset($da[0]);\n\t\t$dwa = array_pad([], $daysinmonth + 1, null);\n\t\tunset($dwa[0]);\n\t\tforeach ($this->_attr[self::DAY_OF_MONTH] as $d) {\n\t\t\tif ($d['dom'] === '*' || $d['dom'] === '?') {\n\t\t\t\t$domStar = (($d['dom'] == '?') || ($d['period'] == 1));\n\t\t\t\tforeach ($da as $key => $value) {\n\t\t\t\t\tif (($key - 1) % $d['period'] == 0) {\n\t\t\t\t\t\t$da[$key] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} elseif (is_numeric($d['dom'])) {\n\t\t\t\t$startDay = $d['dom'];\n\t\t\t\tif ($d['domWeekday']) {\n\t\t\t\t\t$datea = getdate(strtotime(\"$year-$month-$startDay\"));\n\t\t\t\t\tif ($datea['wday'] == 6) {\n\t\t\t\t\t\tif ($startDay == 1) {\n\t\t\t\t\t\t\t$startDay = 3;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$startDay--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif ($datea['wday'] == 0) {\n\t\t\t\t\t\tif ($startDay == $daysinmonth) {\n\t\t\t\t\t\t\t$startDay = $daysinmonth - 2;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$startDay++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$endDay = $d['end'];\n\t\t\t\tif ($d['endWeekday']) {\n\t\t\t\t\t$datea = getdate(strtotime(\"$year-$month-$endDay\"));\n\t\t\t\t\tif ($datea['wday'] == 6) {\n\t\t\t\t\t\tif ($endDay == 1) {\n\t\t\t\t\t\t\t$endDay = 3;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$endDay--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif ($datea['wday'] == 0) {\n\t\t\t\t\t\tif ($endDay == $daysinmonth) {\n\t\t\t\t\t\t\t$endDay = $daysinmonth - 2;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$endDay++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor ($i = $startDay; $i <= $endDay && $i <= 31; $i += $d['period']) {\n\t\t\t\t\t$da[$i] = 1;\n\t\t\t\t}\n\t\t\t} elseif ($d['dom'] == 'L') {\n\t\t\t\t$less = empty($d['end']) ? 0 : $d['end'];\n\t\t\t\t$da[$daysinmonth - $less] = 1;\n\t\t\t}\n\t\t}\n\t\t$firstDatea = getdate(strtotime(\"$year-$month-01\"));\n\t\tforeach ($this->_attr[self::DAY_OF_WEEK] as $d) {\n\t\t\tif (is_numeric($d['dow'])) {\n\t\t\t\t//start at the first sunday on or before the 1st day of the month\n\t\t\t\tfor ($i = 1 - $firstDatea['wday']; $i <= $daysinmonth; $i += 7) {\n\t\t\t\t\tfor ($ii = $d['dow']; ($ii <= $d['end']) && ($ii < 7) && (($i + $ii) <= $daysinmonth); $ii += $d['period']) {\n\t\t\t\t\t\t$iii = $i + $ii;\n\t\t\t\t\t\t$w = floor(($iii + 6) / 7);\n\t\t\t\t\t\t$lw = floor(($daysinmonth - $iii) / 7);\n\n\t\t\t\t\t\tif (($iii >= 0) && ((!$d['week'] || $d['week'] == $w) && (!$d['lastDow'] || $lw == 0))) {\n\t\t\t\t\t\t\t$dwa[$iii] = 1;\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\tif ($dowStar) {\n\t\t\treturn $da;\n\t\t} elseif ($domStar) {\n\t\t\treturn $dwa;\n\t\t}\n\t\tforeach ($da as $key => $value) {\n\t\t\t$da[$key] = $value && ($dwa[$key] ?? 0);\n\t\t}\n\t\treturn $da;\n\t}", "public static function create_calendar($month,$year,$calendar){\n\t\t// usamos mktime para crear la fecha exacta que queremos para crear valor $time \n\t\t$running_day = date('w',mktime(0,0,0,$month,1,$year)); // w devuelve el numero del dia de la semana\n\t\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year)); //t devuelve el numero de dias del mes\n\t\t$days_in_week = 0;\n\t\t$day = 1;\n\t\t$week = 0;\n\t\t\n\t\t// Mandamos datos de los dias de la semana al arreglo\n\t\t// Imprimimos dias en blanco hasta alcanzar el primero en la semana\n\t\tfor ($days_in_week = 0; $days_in_week < $running_day; $days_in_week++){\n\t\t\t$calendar [$week][$days_in_week] = 0;\n\t\t}\n\t\t\n\t\t// Procedemos con los dias\n\t\twhile ($day <= $days_in_month) {\n\t\t// Mientras no se llegue al numero de dias del mes llenamos el arreglo\n\t\t\twhile($days_in_week < 7) { \n\t\t\t// Asignamos los dias restantes mientras no lleguemos al tope de dias de semana 7.\n\t\t\t// Al terminar los dias del mes seguimos llenando el arreglo de vacio\n\t\t\t\tif ($day <= $days_in_month){\n\t\t\t\t\t$calendar [$week][$days_in_week] = $day;\n\t\t\t\t} else {\n\t\t\t\t\t$calendar [$week][$days_in_week] = 0;\n\t\t\t\t}\n\n\t\t\t\t$days_in_week++;\n\t\t\t\t$day++;\n\t\t\t}\n\t\t\t$days_in_week = 0;\n\t\t\t$week++;\n\n\t\t}\n\t\treturn $calendar;\n\t}", "private function _get_calendar_array()\n\t{\n\t $this->all_events = $this->result->xpath(\".//event\");\n\t \n\t foreach($this->all_events as $an_event):\n\t $start_at = $an_event->xpath(\"./start-at\");\n \t $start_at = $start_at[0];\n \t $end_at = $an_event->xpath(\"./end-at\");\n \t $end_at = $end_at[0];\n \t \n \t $start_at = new DateTime($start_at);\n \t $start_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $start_at->setTime(0, 0, 0);\n \t $end_at = new DateTime($end_at);\n \t $end_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $end_at->setTime(0, 0, 0);\n \t \n \t $start_timestamp = strtotime($start_at->format('Y-m-d'));\n $end_timestamp = strtotime($end_at->format('Y-m-d'));\n \n $start_year = date(\"Y\", $start_timestamp);\n $end_year = date(\"Y\", $end_timestamp);\n $start_month = date(\"m\", $start_timestamp);\n $end_month = date(\"m\", $end_timestamp);\n $start_day = date(\"d\", $start_timestamp);\n $start_day = $start_day + 1;\n $end_day = date(\"d\", $end_timestamp);\n $end_day = $end_day + 1;\n \n if(($start_year == $this->year && $start_month == $this->month) || ($end_year == $this->year && $end_month == $this->month)):\n if($start_year == $end_year):\n if($start_month == $end_month):\n $this->_calendar_array_one($start_day, $end_day);\n else:\n if($end_month != $this->month):\n $this->_calendar_array_two($start_day);\n else:\n $this->_calendar_array_three($end_day);\n endif;\n endif;\n endif;\n endif;\n endforeach;\n \n\t foreach($this->callinks as $callinks):\n\t foreach($callinks as $key => $value):\n\t $this->combined_callinks[\"$key\"] = $value;\n\t endforeach;\n\t endforeach;\n\t}", "private function baseCalendarArray($date, $fday, $lday, $monthHolidays){\n $calendar = array();\n for($day = $fday; $day < $lday+1; $day++)\n {\n\n $calendar = $this->setDay($calendar, $day);\n $calendar = $this->setDayName($calendar, $day, $this->date, \"D\");\n\n if(!empty($event[$day]))\n $calendar = $this->setDayEvent($calendar, $day, $event[$day]);\n \n\n if($date->isWeekend())\n {\n $calendar = $this->setDayWeekend($calendar, $day, \"Weekend\");\n $calendar = $this->setDayColor($calendar, $day, 'purple');\n }\n else \n {\n $calendar = $this->setDayColor($calendar, $day, 'white');\n }\n\n if(!empty($monthHolidays[$day]))\n {\n $calendar = $this->setDayEvent($calendar, $day, $monthHolidays[$day]['event']);\n $calendar = $this->setDayColor($calendar, $day, 'pink');\n }\n \n $date->addDay();\n }\n\n return $calendar;\n }", "function get_month_days ($month) {\n $labels = array();\n $month = month_converter($month);\n $monthdays = cal_days_in_month(CAL_GREGORIAN, $month, $date->format('Y'));\n $day = $date->format('d');\n $i = 0;\n while ($i < 30) {\n if ($day <= $monthdays) {\n if (strlen($day) == 1) {\n $day = '0' . $day;\n }\n if (strlen($month) == 1) {\n $month = '0' . $month;\n }\n $labels[] = $day.'-'.$month;\n $day++;\n $i++;\n } else {\n $day = 1;\n $month++;\n $monthdays = cal_days_in_month(CAL_GREGORIAN, $month, $date->format('Y'));\n }\n }\n return $labels;\n}", "function CalendarData($month=null, $year=null) {\n if (is_null($year)) $year = date('Y');\n if (is_null($month)) $month = date('n');\n\n // RENDER\n exec(\"cal \".$month.\" \". $year, $cal); $this->dbgMsg( ' ### calendar '.$month.\" \". $year.\" :: \", $cal );\n $rxp[] = array_fill(0,7,' ');\n for ($k=2; $k < count($cal); $k++ ) {\n $xpl = explode(' ', trim( preg_replace('{\\s+}i', ' ', $cal[$k]) ) );\n if (count($xpl) && $xpl[0]!=='' ) { // $this->dbgMsg(' xploded row', $xpl, 1,1 );\n if ( $wsp=7-count($xpl) ) {\n if ($k==2) $rx = array_merge( array_fill(0, $wsp, ' ' ), $xpl );\n else $rx = array_merge( $xpl, array_fill(count($xpl)+1, $wsp, ' ' ) );\n }\n else $rx = $xpl;\n $rxp[] = $rx;\n }\n }\n\n for ($j=1; $j < count($rxp); $j++ ) {\n for ($d=0; $d<7; $d++) {\n if ($d===0) $rxp[$j-1][6] = $rxp[$j][0];\n else $rxp[$j][$d-1] = $rxp[$j][$d];\n }\n }\n $rxp[$j-1][$d-1]=' ';\n foreach ($rxp as $j=>$r) { // $this->dbgMsg( \"str_replace(' ','',implode('',\".$rxp[$j].\") )\", str_replace(' ','',implode('',$rxp[$j]) ) );\n if ( !str_replace(' ','',implode('',$rxp[$j]) ) ) unset($rxp[$j]); // NEED FOR TESTS\n } // $this->dbgMsg(' exploded calendar : ', $rxp, 1,1 );\n\n foreach ( $rxp as $i=>$arr ) {\n foreach ( $arr as $k=>$day) {\n $clr = array();\n if ( is_numeric($day) ) { // $this->dbgMsg( 'CalDay is_numeric( '.$day.' ) ', 'YES' );\n $Mm = $month<10?('0'.$month):$month;\n $Dd = $day<10?('0'.$day):$day;\n $key_date = $year.'-'.$Mm.'-'.$Dd; // $href_date = $year.'/'.$Mm.'/'.$Dd;\n $clauses = array();\n $clauses[] = \"'\".$key_date.\"' >= s.`date_start` and '\".$key_date.\"' <= s.`date_stop`\";\n $clauses[] = \"s.`status`<>'closed'\"; // $this->dbgMsg('', $clauses );\n $sql = $this->sql10.\" where \".implode(' and ', $clauses);\n $a = $this->db->sql2array( $sql ); // $this->dbgMsg(\" cal Day :: \".$sql, $a ); // выборка фильм+площадка+сеанс\n\n if ( $key_date == $this->guide->uri_parts[1] ) {\n $clr['tpl'] = '_Curr';\n $clr['Misc'] = ' style=\"color:#333;\"';\n // } elseif ( !empty($a) ) { // так - со ссылками в прошлое\n } elseif ( !empty($a) && date(\"Y-m-d\") <= $key_date ) {\n $clr['tpl'] = '_Href';\n $clr['DayHref']= 'film/'.$key_date.'/';\n if ( $k>4 ) $clr['Misc'] = ' style=\"color:#990000;\"';\n } else {\n $clr['tpl'] = '_Item';\n }\n }\n $clr['DayNum']=$day;\n $rxp[$i][$k] = $this->tpl->ParseOne( $clr, $this->tpf.':CalDay'.$clr['tpl'], '' );\n } // $rxp[$i]['trMisc'] = ' style=\"'.(($i%2==1)?'background:#eee;\"':'\"');\n $rxp[$i]['tdMisc'] = ' style=\"text-align:right;background-color:#ffffff;color:#ccc;\"';\n } // $this->dbgMsg('EXPANDED calendar : ', $rxp, 1,1 );\n return $rxp;\n }", "public function drawArray()\n\t{\n\t\t$this->outArray['days'] = array();\n\t\t$this->makeCalendarTitle();\n\t\t$this->makeCalendarHead();\n\t\t$this->makeDayHeadings();\n\t\t$this->startMonthSpacers();\n\t\t$this->makeArrayIterator();\n\t\t$this->endMonthSpacers();\t\t\n\t\t\n\t\treturn $this->outArray;\n\t}", "function get_month_days_cm ($fecha) {\n $labels = array();\n $month = month_converter($fecha->month);\n $monthdays = cal_days_in_month(CAL_GREGORIAN, $fecha->month, $fecha->year);\n $i = 0;\n while ($i < $monthdays) {\n $i++;\n $labels[] = $i;\n }\n return $labels;\n}", "function _getCalendarData( $year, $month, $day){\t\t\t\t\n\t\t$rows = $this->_listIcalEventsByMonth( $year, $month);\n \t\t\n\t\t$rowcount = count( $rows );\t\t\n\t\t$data = array();\n\t\t$data['year'] = $year;\n\t\t$data['month'] = $month;\n\t\t$month = intval($month);\n\t\tif( $month <= '9' ) {\n\t\t\t$month = '0' . $month;\n\t\t}\n\t\t$data['startday'] = $startday = (int) EventBookingHelper::getConfigValue('calendar_start_date');\t\t\n\t\t// get days in week\n\t\t$data[\"daynames\"] = array();\n\t\tfor( $i = 0; $i < 7; $i++ ) {\n\t\t\t$data[\"daynames\"][$i] = $this->_getDayName(($i+$startday)%7, true );\n\t\t}\t\t\n\t\t$data[\"dates\"]=array();\t\t\n\t\t//Start days\n\t\t$start = (( date( 'w', mktime( 0, 0, 0, $month, 1, $year )) - $startday + 7 ) % 7 );\t\t\n\t\t// previous month\n\t\t$priorMonth = $month-1;\n\t\t$priorYear = $year;\t\t\n\t\tif ($priorMonth <= 0) {\n\t\t\t$priorMonth += 12;\n\t\t\t$priorYear -= 1;\n\t\t}\t\t\t\n\t\t$dayCount=0;\n\t\tfor( $a = $start; $a > 0; $a-- ){\n\t\t\t$data[\"dates\"][$dayCount] = array();\n\t\t\t$data[\"dates\"][$dayCount][\"monthType\"] = \"prior\";\n\t\t\t$data[\"dates\"][$dayCount][\"month\"] = $priorMonth;\n\t\t\t$data[\"dates\"][$dayCount][\"year\"] = $priorYear;\n\t\t\t$data[\"dates\"][$dayCount]['countDisplay'] = 0;\n\t\t\t$dayCount++;\n\t\t}\n\t\tsort($data[\"dates\"]);\n\t\t//Current month\n\t\t$end = date( 't', mktime( 0, 0, 0,( $month + 1 ), 0, $year ));\n\t\tfor( $d = 1; $d <= $end; $d++ ){\n\t\t\t$data[\"dates\"][$dayCount]=array();\n\t\t\t// utility field used to keep track of events displayed in a day!\n\t\t\t$data[\"dates\"][$dayCount]['countDisplay']=0;\n\t\t\t$data[\"dates\"][$dayCount][\"monthType\"]=\"current\";\n\t\t\t$data[\"dates\"][$dayCount][\"month\"]=$month;\n\t\t\t$data[\"dates\"][$dayCount][\"year\"]=$year;\t\t\n\t\t\t\t\t\t\n\t\t\t$t_datenow = $this->_getNow();\n\t\t\t$now_adjusted = $t_datenow->toUnix(true);\n\t\t\tif( $month == strftime( '%m', $now_adjusted)\n\t\t\t&& $year == strftime( '%Y', $now_adjusted)\n\t\t\t&& $d == strftime( '%d', $now_adjusted)) {\n\t\t\t\t$data[\"dates\"][$dayCount][\"today\"]=true;\n\t\t\t}else{\n\t\t\t\t$data[\"dates\"][$dayCount][\"today\"]=false;\n\t\t\t}\n\t\t\t$data[\"dates\"][$dayCount]['d']=$d;\t\t\t\t\t\t\n\t\t\t$data[\"dates\"][$dayCount]['events'] = array();\n\t\t\tif( $rowcount > 0 ){\n\t\t\t\tforeach ($rows as $row) {\n\t\t\t\t\t\t$date_of_event = explode('-',$row->event_date);\n\t\t\t\t\t\t$date_of_event = (int)$date_of_event[2];\t\t\t\t\t\t\n\t\t\t\t\t\tif ($d == $date_of_event ){\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$i=count($data[\"dates\"][$dayCount]['events']);\n\t\t\t\t\t\t\t$data[\"dates\"][$dayCount]['events'][$i] = $row;\n\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t$dayCount++;\n\t\t}\t\n \t\n\t\t// followmonth\n\t\t$days \t= ( 7 - date( 'w', mktime( 0, 0, 0, $month + 1, 1, $year )) + $startday ) %7;\n\t\t$d\t\t= 1;\n\t\t$followMonth = $month+1;\n\t\t$followYear = $year;\n\t\tif ($followMonth>12) {\n\t\t\t$followMonth-=12;\n\t\t\t$followYear+=1;\n\t\t}\n\t\t$data[\"followingMonth\"]=array();\n\t\tfor( $d = 1; $d <= $days; $d++ ) {\n\t\t\t$data[\"dates\"][$dayCount]=array();\n\t\t\t$data[\"dates\"][$dayCount][\"monthType\"]=\"following\";\n\t\t\t$data[\"dates\"][$dayCount][\"month\"]=$followMonth;\n\t\t\t$data[\"dates\"][$dayCount][\"year\"]=$followYear;\n\t\t\t$data[\"dates\"][$dayCount]['countDisplay']=0;\n\t\t\t$dayCount++;\n\t\t}\n\t\treturn $data;\t\t\n\t}", "function getDays_ym($month, $year){\n // Start of Month\n $start = new DateTime(\"{$year}-{$month}-01\");\n $month = $start->format('F');\n\n // Prepare results array\n $results = array();\n\n // While same month\n while($start->format('F') == $month){\n // Add to array\n $day = $start->format('D');\n $sort_date = $start->format('j');\n $date = $start->format('Y-m-d');\n $results[$date] = ['day' => $day,'sort_date' => $sort_date,'date' => $date];\n\n // Next Day\n $start->add(new DateInterval(\"P1D\"));\n }\n // Return results\n return $results;\n}", "private function getDatesInMonth() {\n $viewer = $this->getViewer();\n\n $timezone = new DateTimeZone($viewer->getTimezoneIdentifier());\n\n $month = $this->month;\n $year = $this->year;\n\n list($next_year, $next_month) = $this->getNextYearAndMonth();\n\n $end_date = new DateTime(\"{$next_year}-{$next_month}-01\", $timezone);\n\n list($start_of_week, $end_of_week) = $this->getWeekStartAndEnd();\n\n $days_in_month = id(clone $end_date)->modify('-1 day')->format('d');\n\n $first_month_day_date = new DateTime(\"{$year}-{$month}-01\", $timezone);\n $last_month_day_date = id(clone $end_date)->modify('-1 day');\n\n $first_weekday_of_month = $first_month_day_date->format('w');\n $last_weekday_of_month = $last_month_day_date->format('w');\n\n $day_date = id(clone $first_month_day_date);\n\n $num_days_display = $days_in_month;\n if ($start_of_week !== $first_weekday_of_month) {\n $interim_start_num = ($first_weekday_of_month + 7 - $start_of_week) % 7;\n $num_days_display += $interim_start_num;\n\n $day_date->modify('-'.$interim_start_num.' days');\n }\n if ($end_of_week !== $last_weekday_of_month) {\n $interim_end_day_num = ($end_of_week - $last_weekday_of_month + 7) % 7;\n $num_days_display += $interim_end_day_num;\n $end_date->modify('+'.$interim_end_day_num.' days');\n }\n\n $days = array();\n\n for ($day = 1; $day <= $num_days_display; $day++) {\n $day_epoch = $day_date->format('U');\n $end_epoch = $end_date->format('U');\n if ($day_epoch >= $end_epoch) {\n break;\n } else {\n $days[] = clone $day_date;\n }\n $day_date->modify('+1 day');\n }\n\n return $days;\n }", "private function _calendar_array_two($start_d)\n\t{\n\t $days_array = array();\n $days_url_array = array();\n $days_in_month = days_in_month($this->month, $this->year) + 1;\n \n for($i = $start_d; $i < $days_in_month; $i++):\n array_push($days_array, $i);\n endfor;\n \n foreach($days_array as $day):\n $stampeddate = strtotime($this->year.\"-\".$this->month.\"-\".$day);\n array_push($days_url_array, URL::base(TRUE, TRUE).\"calendar_day/\".date(\"j\", $stampeddate).\"/\".date(\"n\", $stampeddate).\"/\".date(\"Y\", $stampeddate));\n endforeach;\n \n array_push($this->callinks, array_combine($days_array, $days_url_array));\n\t}", "public static function month_calendar($day, $month, $year) {\r\n global $langDay_of_weekNames, $langMonthNames, $langToday, $langDay, $langWeek, $langMonth, $langViewShow;\r\n\r\n $calendar_content = \"\";\r\n //Handle leap year\r\n $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);\r\n if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {\r\n $numberofdays[2] = 29;\r\n }\r\n\r\n $eventlist = Calendar_Events::get_calendar_events(\"month\", \"$year-$month-$day\");\r\n\r\n $events = array();\r\n if ($eventlist) {\r\n foreach ($eventlist as $event) {\r\n $eventday = new DateTime($event->startdate);\r\n $eventday = $eventday->format('j');\r\n if (!array_key_exists($eventday,$events)) {\r\n $events[$eventday] = array();\r\n }\r\n array_push($events[$eventday], $event);\r\n }\r\n }\r\n\r\n //Get the first day of the month\r\n $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));\r\n //Start the week on monday\r\n $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;\r\n\r\n $backward = array('month'=>$month == 1 ? 12 : $month - 1, 'year' => $month == 1 ? $year - 1 : $year);\r\n $foreward = array('month'=>$month == 12 ? 1 : $month + 1, 'year' => $month == 12 ? $year + 1 : $year);\r\n\r\n $calendar_content .= '<div class=\"right\" style=\"width:100%\">'.$langViewShow.':&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_day(selectedday, selectedmonth, selectedyear);return false;\">'.$langDay.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_week(selectedday, selectedmonth, selectedyear);return false;\">'.$langWeek.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_month(selectedday, selectedmonth, selectedyear);return false;\">'.$langMonth.'</a></div>';\r\n\r\n $calendar_content .= '<table width=100% class=\"title1\">';\r\n $calendar_content .= \"<tr>\";\r\n $calendar_content .= '<td width=\"250\"><a href=\"#\" onclick=\"show_month(1,'.$backward['month'].','.$backward['year'].'); return false;\">&laquo;</a></td>';\r\n $calendar_content .= \"<td class='center'><b>{$langMonthNames['long'][$month-1]} $year</b></td>\";\r\n $calendar_content .= '<td width=\"250\" class=\"right\"><a href=\"#\" onclick=\"show_month(1,'.$foreward['month'].','.$foreward['year'].'); return false;\">&raquo;</a></td>';\r\n $calendar_content .= \"</tr>\";\r\n $calendar_content .= \"</table><br />\";\r\n $calendar_content .= \"<table class='table-default'><tr class='list-header'>\";\r\n for ($ii = 1; $ii < 8; $ii++) {\r\n $calendar_content .= \"<th class='text-center'>\" . $langDay_of_weekNames['long'][$ii % 7] . \"</th>\";\r\n }\r\n $calendar_content .= \"</tr>\";\r\n $curday = -1;\r\n $today = getdate();\r\n\r\n while ($curday <= $numberofdays[$month]) {\r\n $calendar_content .= \"<tr>\";\r\n\r\n for ($ii = 0; $ii < 7; $ii++) {\r\n if (($curday == -1) && ($ii == $startdayofweek)) {\r\n $curday = 1;\r\n }\r\n if (($curday > 0) && ($curday <= $numberofdays[$month])) {\r\n $bgcolor = $ii < 5 ? \"class='alert alert-danger'\" : \"class='odd'\";\r\n $dayheader = \"$curday\";\r\n $class_style = \"class=odd\";\r\n if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {\r\n $dayheader = \"<b>$curday</b> <small>($langToday)</small>\";\r\n $class_style = \"class='today'\";\r\n }\r\n $calendar_content .= \"<td height=50 width=14% valign=top $class_style><b>$dayheader</b>\";\r\n $thisDayItems = \"\";\r\n if (array_key_exists($curday, $events)) {\r\n foreach ($events[$curday] as $ev) {\r\n $thisDayItems .= Calendar_Events::month_calendar_item($ev, Calendar_Events::$calsettings->{$ev->event_group.\"_color\"});\r\n }\r\n $calendar_content .= \"$thisDayItems</td>\";\r\n }\r\n $curday++;\r\n } else {\r\n $calendar_content .= \"<td width=14%>&nbsp;</td>\";\r\n }\r\n }\r\n $calendar_content .= \"</tr>\";\r\n }\r\n $calendar_content .= \"</table>\";\r\n\r\n /* Legend */\r\n $calendar_content .= Calendar_Events::calendar_legend();\r\n\r\n\r\n /*************************************** Bootstrap calendar ******************************************************/\r\n\r\n $calendar_content .= '<div id=\"bootstrapcalendar\"></div>';\r\n\r\n return $calendar_content;\r\n }", "protected function compileDays()\n\t{\n\t\t$arrDays = array();\n\n\t\tfor ($i=0; $i<7; $i++)\n\t\t{\n\t\t\t$intCurrentDay = ($i + $this->cal_startDay) % 7;\n\t\t\t$arrDays[$intCurrentDay] = $GLOBALS['TL_LANG']['DAYS'][$intCurrentDay];\n\t\t}\n\n\t\treturn $arrDays;\n\t}", "public function calendar($year_month = null) {\n\n if(!isset($year_month)) {\n /* Setting the data and creating the first and last day of a month */\n $start_date = date('Y-m-01');\n $end_date = date('Y-m-t');\n }\n else {\n /* Getting the data and creating the first and last day of a month */\n $start_date = date('Y-m-d', strtotime($year_month.'-01'));\n $end_date = date('Y-m-t', strtotime($year_month.'-01'));\n }\n\n /* Querying the database to get the events for all days of certain month of the year */\n $calendar = [];\n $activities = [];\n while($start_date <= $end_date) {\n\n //Temporalmente, pedido por Amparo, ¿Qué te dije?, igual y mañana se queja de que se ven los eventos sin aprobar :P\n /*\n $events = EventDCI::whereRaw('end_day >= ? and start_day <= ? and (dci_status = ? or dci_status = ?) and user_status = ?',\n array($start_date, $start_date, 'En Proceso', 'Aprobado', 'Activo'))\n ->orderBy('time')->get();\n */\n $events = EventDCI::whereRaw('end_day >= ? and start_day <= ?',\n array($start_date, $start_date))\n ->orderBy('time')->get();\n\n $activities['activities'] = $events->toArray();\n\n //ola k ase\n $activities['date'] = $start_date;\n\n array_push($calendar, $activities);\n $activities = [];\n\n $next_date = new DateTime($start_date);\n $next_date->add(new DateInterval('P1D'));\n $s_next_date = $next_date->format('Y-m-d');\n $start_date = explode(' ', $s_next_date)[0];\n }\n\n return json_encode($calendar);\n\n }", "public function daysOfMonthProvider(): array\n {\n return [\n // Time Days Match?\n ['1st January', [1], true],\n ['2nd January', [1], false],\n ['2nd January', [2], true],\n ['2nd January', [1, 2], true],\n ['31st January', [1, 8, 23, 31], true],\n ['29th February 2020', [29], true],\n ];\n }", "function get_daily_weather_for_month( \n $y = 2014, \n $m = 01 )\n {\n $days = date( 't', mktime( 0, 0, 0, $m, 1, $y ) );\n $data = array();\n for ( $i = 1; $i <= $days; $i++ ) {\n $date = date( 'Y-m-d', mktime( 0, 0, 0, $m, $i, $y ) );\n $results = $this->_db->select( \n \"SELECT * \n FROM weather_days\n WHERE date_day = '\".$date.\"'\" );\n if ( is_object( $results[0] ) ) {\n $data[$i] = $results[0];\n }\n }\n return $data;\n }", "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 draw_calendar($month,$year,$activityStartDateArray = array()){\r\n\r\n\t/* draw table */\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\r\n\t/* table headings */\r\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t/* days and weeks vars now ... */\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t/* row for week one */\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\t/* print \"blank\" days until the first of the current week */\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\t/* keep going with days.... */\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\">';\r\n\t\t\t/* add in the day number */\r\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\r\n\t\t\t\r\n\t\t\t//eventdate=startdate and enddate, depends which we talks about \r\n\r\n\t\t\t$startDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\t//$endDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\techo \"<br>the start date is\".$startDate;\r\n\t\t\t//something is wrong wit hteh startDate, the origin code has a while loop in the beginning, think why \r\n\t\t\t\r\n\t\t\tif(isset($activityStartDateArray[$startDate])) {\r\n\t\t\t\tforeach($activityStartDateArray[$startDate] as $activity) {\r\n\t\t\t\t\t$calendar.= '<div class=\"activity\">'.$activity['activityName'].'</div>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\telse {\r\n\t\t\t\t$calendar.= str_repeat('<p>&nbsp;</p>',2);\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\t\r\n\t\r\n\t/* finish the rest of the days in the week */\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t/* final row */\r\n\t$calendar.= '</tr>';\r\n\t\r\n\r\n\t/* end the table */\r\n\t$calendar.= '</table>';\r\n\r\n\t/** DEBUG **/\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\t\r\n\t/* all done, return result */\r\n\treturn $calendar;\r\n}", "function getCalendarsForAdmin() {\n //\n // http://dev4.krubner.com/admin.php?page=admin_calendar\n //\n // this brings back 2 months worth of days to show in a calendar\n\n global $controller; \n\n $today = new DateTime(date('Y-m-d'));\n\n //Get Calendar for this week\n if(!isset($_GET['ym'])){\n $top_month = date('Y-m');\n } else {\n $top_month = $_GET['ym'];\n }\n\n $firstDayOfMonthDateTime = new DateTime($top_month.\"-01\");\n $lastDayOfMonthDateTime = clone $firstDayOfMonthDateTime;\n $lastDayOfMonthDateTime->modify(\"+1 month\");\n $lastDayOfMonthDateTime->modify(\"-1 day\");\n\n $arrayOfDaysForThisMonth = array();\n $arrayOfDaysForThisMonth = $controller->command(\"loadAllNights\", $firstDayOfMonthDateTime, $lastDayOfMonthDateTime); \n\n $calendars = array();\n $calendars[$top_month] = $arrayOfDaysForThisMonth;\n\n $firstDayOfMonthDateTime2 = clone $firstDayOfMonthDateTime;\n $firstDayOfMonthDateTime2->modify(\"+1 month\");\n $lastDayOfMonthDateTime2 = clone $firstDayOfMonthDateTime2;\n $lastDayOfMonthDateTime2->modify(\"+1 month\");\n $lastDayOfMonthDateTime2->modify(\"-1 day\");\n\n $arrayOfDaysForThisMonth = array();\n $arrayOfDaysForThisMonth = $controller->command(\"loadAllNights\", $firstDayOfMonthDateTime2, $lastDayOfMonthDateTime2); \n\n $calendars[$lastDayOfMonthDateTime2->format('Y-m')] = $arrayOfDaysForThisMonth;\n\n return $calendars; \n}", "public function CreateSelectArray()\n {\n\t\t//Make the array relative to today.... ill do later.\n\t\t$this->TodayDate = \"\";\n\t\t$this->TodaysDate = $this->GetTodaysDate();\t \t\n\t\t$days = 0;\t\t\n \n\t\t$LISTofDATES = [];\n\t\t\n\t\tfor($ya = 2020; $ya < 2040; $ya++) {\n\t\t\t$year = \"\".$ya.\"\";\n\t\t\t$LISTofDATES[$year] = [ \"January\" => 0, \"February\" => 0, \"March\" => 0, \"April\" => 0, \"May\" => 0, \"June\" => 0, \"July\" => 0, \"August\" => 0, \"September\" => 0, \"October\" => 0, \"November\" => 0, \"December\" => 0 ];\t \n\t\t}\n\n\t\tforeach ( $LISTofDATES as $Year => $Months )\n\t\t{\t\t\t\n\t\t\tfor( $Month = 1; $Month <= 12; $Month++ )\n\t\t\t{\n\t\t\t\tif ( $Month == 1 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['January'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 2 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['February'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 3 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['March'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 4 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['April'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 5 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['May'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 6 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['June'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 7 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['July'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 8 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['August'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 9 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['September'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 10 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['October'] = $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 11 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['November']= $days;\n\t\t\t\t}\n\t\t\t\tif ( $Month == 12 )\n\t\t\t\t{\n\t\t\t\t\t$days = cal_days_in_month(CAL_GREGORIAN, $Month, $Year);\n\t\t\t\t\t$LISTofDATES[$Year]['December'] = $days;\n\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t}\t \n\t\t}//For each Year done\t\t\n\t\t/*Should have a fully populated array of days for each month in 2 years*/\t\t\n\t\treturn json_encode($LISTofDATES);\t\t\t\t\n }", "function ShowDayOfMonth($get_month){\n\t$arr_d1 = explode(\"-\",$get_month);\n\t$xdd = \"01\";\n\t$xmm = \"$arr_d1[1]\";\n\t$xyy = \"$arr_d1[0]\";\n\t$get_date = \"$xyy-$xmm-$xdd\"; // วันเริ่มต้น\n\t//echo $get_date.\"<br>\";\n\t$xFTime1 = getdate(date(mktime(0, 0, 0, intval($xmm+1), intval($xdd-1), intval($xyy))));\n\t$numcount = $xFTime1['mday']; // ฝันที่สุดท้ายของเดือน\n\tif($numcount > 0){\n\t\t$j=1;\n\t\t\tfor($i = 0 ; $i < $numcount ; $i++){\n\t\t\t\t$xbasedate = strtotime(\"$get_date\");\n\t\t\t\t $xdate = strtotime(\"$i day\",$xbasedate);\n\t\t\t\t $xsdate = date(\"Y-m-d\",$xdate);// วันถัดไป\t\t\n\t\t\t\t $arr_d2 = explode(\"-\",$xsdate);\n\t\t\t\t $xFTime = getdate(date(mktime(0, 0, 0, intval($arr_d2[1]), intval($arr_d2[2]), intval($arr_d2[0]))));\t\n\t\t\t\t if($xFTime['wday'] == 0){\n\t\t\t\t\t $j++;\n\t\t\t\t\t\t \n\t\t\t\t\t}\n\t\t\t\t\tif($xFTime['wday'] != \"0\"){\n\t\t\t\t\t\t$arr_date[$j][$xFTime['wday']] = $xsdate;\t\n\t\t\t\t\t}\n\t\t\t\t \n\t\t\t}\n\t\t\t\n\t}//end if($numcount > 0){\n\treturn $arr_date;\t\n}", "function draw_calendar($month,$year){\r\n\t/*Naredi koledar*/\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\t\r\n\t$headings = array('Nedelja','Ponedeljek','Torek','Sreda','Cetrtek','Petek','Sobota');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\tif($list_day < 10) {\r\n $list_day = str_pad($list_day, 2, '0', STR_PAD_LEFT);\r\n }\r\n\t\t$month = str_pad($month, 2, '0', STR_PAD_LEFT);\r\n\t\t$event_day = $year.'-'.$month.'-'.$list_day;\r\n\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div name=\"test\" style=\"height:100px; width:120px; overflow: auto; white-space:nowrap\" id=' .$event_day. ' onclick=\"modal(this.id);\">';\r\n\t\t$calendar.= '<div>'.$list_day.'</div>';\t\r\n\t\t$query = \"SELECT CONCAT_WS(' ',s.firstname,s.lastname) as Zaposleni, a.name, aa.aktivnost_id\r\n\t\t\tFROM ost_staff s, ost_agent_aktivnost aa, ost_aktivnosti a\r\n\t\t\tWHERE s.staff_id = aa.staff_id and a.id=aa.aktivnost_id and '$event_day' BETWEEN aa.aktivnost_od AND aa.aktivnost_do AND aa.aktivnost_id > 1 AND aa.aktivnost_id != 9 AND aa.aktivnost_id != 10\";\r\n\t\t\t$result = db_query($query) or die('Ne morem pridobiti rezultata!');\r\n\t\t\twhile($row = db_fetch_array($result)) {\r\n\t\t\t\t$words = explode(' ',$row['Zaposleni']);\r\n\t\t\t\t$calendar .= '<div>'.$words[0][0].'. '.$words[1][0].'. : '.$row['name'].'</div>';\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t$calendar.= '</tr>';\r\n\r\n\t$calendar.= '</table>';\r\n\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\r\n\treturn $calendar;\r\n}", "public static function twoDArrayforCalender()\n {\n $array = [];\n for ($i = 0; $i < 6; $i++) \n {\n $array1 = array();\n for ($j = 0; $j < 7; $j++) \n {\n //initializing array values to '-'\n $array1[$j] = '-';\n }\n //pushing array to each row of 2d array\n array_push($array, $array1);\n }\n return $array;\n }", "function build_calendar($month,$year,$dateArray) {\n $daysOfWeek = array('S','M','T','W','T','F','S');\n\n // What is the first day of the month in question?\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\n\n // How many days does this month contain?\n $numberDays = date('t',$firstDayOfMonth);\n\n // Retrieve some information about the first day of the\n // month in question.\n $dateComponents = getdate($firstDayOfMonth);\n\n // What is the name of the month in question?\n $monthName = $dateComponents['month'];\n\n // What is the index value (0-6) of the first day of the\n // month in question.\n $dayOfWeek = $dateComponents['wday'];\n\n // Create the table tag opener and day headers\n\n $calendar = \"<table class='calendar'>\";\n $calendar .= \"<caption>$monthName $year</caption>\";\n $calendar .= \"<tr>\";\n\n // Create the calendar headers\n\n foreach($daysOfWeek as $day) {\n $calendar .= \"<th class='header'>$day</th>\";\n }\n\n // Create the rest of the calendar\n\n // Initiate the day counter, starting with the 1st.\n\n $currentDay = 1;\n\n $calendar .= \"</tr><tr>\";\n\n // The variable $dayOfWeek is used to\n // ensure that the calendar\n // display consists of exactly 7 columns.\n\n if ($dayOfWeek > 0) {\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\";\n }\n\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\n\n while ($currentDay <= $numberDays) {\n\n // Seventh column (Saturday) reached. Start a new row.\n\n if ($dayOfWeek == 7) {\n\n $dayOfWeek = 0;\n $calendar .= \"</tr><tr>\";\n\n }\n\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\n\n $date = \"$year-$month-$currentDayRel\";\n\n $calendar .= \"<td class='day' rel='$date'>$currentDay</td>\";\n\n // Increment counters\n\n $currentDay++;\n $dayOfWeek++;\n\n }\n\n\n\n // Complete the row of the last week in month, if necessary\n\n if ($dayOfWeek != 7) {\n\n $remainingDays = 7 - $dayOfWeek;\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\";\n\n }\n\n $calendar .= \"</tr>\";\n\n $calendar .= \"</table>\";\n\n return $calendar;\n\n}", "public static function day_calendar($day, $month, $year) {\r\n global $langNoEvents, $langDay, $langWeek, $langMonth, $langViewShow;\r\n\r\n $calendar_content = \"\";\r\n if (is_null($day)) {\r\n $day = 1;\r\n }\r\n $nextdaydate = new DateTime(\"$year-$month-$day\");\r\n $nextdaydate->add(new DateInterval('P1D'));\r\n $previousdaydate = new DateTime(\"$year-$month-$day\");\r\n $previousdaydate->sub(new DateInterval('P1D'));\r\n\r\n $thisday = new DateTime(\"$year-$month-$day\");\r\n $daydescription = ucfirst(format_locale_date($thisday->getTimestamp()));\r\n\r\n $backward = array('day'=>$previousdaydate->format('d'), 'month'=>$previousdaydate->format('m'), 'year' => $previousdaydate->format('Y'));\r\n $foreward = array('day'=>$nextdaydate->format('d'), 'month'=>$nextdaydate->format('m'), 'year' => $nextdaydate->format('Y'));\r\n\r\n $calendar_content .= '<div class=\"right\" style=\"width:100%\">'.$langViewShow.':&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_day(selectedday, selectedmonth, selectedyear);return false;\">'.$langDay.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_week(selectedday, selectedmonth, selectedyear);return false;\">'.$langWeek.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_month(selectedday, selectedmonth, selectedyear);return false;\">'.$langMonth.'</a></div>';\r\n\r\n $calendar_content .= \"<table class='table-default'>\";\r\n $calendar_content .= \"<tr>\";\r\n $calendar_content .= '<td width=\"25\"><a href=\"#\" onclick=\"show_day('.$backward['day'].','.$backward['month'].','.$backward['year'].'); return false;\">&laquo;</a></td>';\r\n $calendar_content .= \"<td class='center'><b>$daydescription</b></td>\";\r\n $calendar_content .= '<td width=\"25\" class=\"right\"><a href=\"#\" onclick=\"show_day('.$foreward['day'].','.$foreward['month'].','.$foreward['year'].'); return false;\">&raquo;</a></td>';\r\n $calendar_content .= \"</tr>\";\r\n $calendar_content .= \"</table>\";\r\n\r\n $eventlist = Calendar_Events::get_calendar_events(\"day\", \"$year-$month-$day\");\r\n $calendar_content .= \"<table class='table-default'>\";\r\n\r\n $curhour = 0;\r\n $now = getdate();\r\n $today = new DateTime($now['year'].'-'.$now['mon'].'-'.$now['mday'].' '.$now['hours'].':'.$now['minutes']);\r\n if ($now['year'].'-'.$now['mon'].'-'.$now['mday'] == \"$year-$month-$day\") {\r\n $thisdayistoday = true;\r\n }\r\n else{\r\n $thisdayistoday = false;\r\n }\r\n $thishour = new DateTime($today->format('Y-m-d H:00'));\r\n $cursorhour = new DateTime(\"$year-$month-$day 00:00\");\r\n $curstarthour = \"\";\r\n\r\n foreach ($eventlist as $thisevent) {\r\n $thiseventstart = new DateTime($thisevent->start);\r\n $thiseventhour = new DateTime($thiseventstart->format('Y-m-d H:00'));\r\n if ($curstarthour != $thiseventhour) { //event date changed\r\n while($cursorhour < $thiseventhour) {\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($cursorhour->format('H:i')) . \"</b></td></tr>\";\r\n if (intval($cursorhour->diff($thiseventhour,true)->format('%h'))>6) {\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n }\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n $curhour += 6;\r\n }\r\n\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n //No hour tr for the event\r\n //$calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($thiseventhour->format('H:i')) . \"</b></td></tr>\";\r\n if ($cursorhour <= $thiseventhour) {\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n $curhour += 6;\r\n }\r\n }\r\n $calendar_content .= Calendar_Events::day_calendar_item($thisevent, 'even');\r\n $curstarthour = $thiseventhour;\r\n }\r\n /* Fill with empty days*/\r\n for($i=$curhour;$i<24;$i+=6) {\r\n if ($thisdayistoday && $thishour>=$cursorhour && intval($cursorhour->diff($thishour,true)->format('%h'))<6)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst($cursorhour->format('H:i')) . \"</b></td></tr>\";\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n $cursorhour->add(new DateInterval('PT6H'));\r\n }\r\n $calendar_content .= \"</table>\";\r\n /* Legend */\r\n $calendar_content .= Calendar_Events::calendar_legend();\r\n\r\n return $calendar_content;\r\n }" ]
[ "0.7222785", "0.69435954", "0.69158983", "0.68997", "0.6889217", "0.6864905", "0.6826922", "0.68108207", "0.6707525", "0.67010236", "0.6694331", "0.66921747", "0.6622807", "0.65878236", "0.65718424", "0.6504943", "0.64617896", "0.6432567", "0.6409523", "0.64075303", "0.63794696", "0.63785", "0.63744175", "0.6306545", "0.62953717", "0.6292728", "0.6278373", "0.62777454", "0.61962736", "0.61920756" ]
0.73546946
0
Toggle showing weekday numbers Set whether or not to add the weekday number in addition to the month number for each calendar day cell.
public function setShowWeekDayNum($sw=false) { $this->addWeekDay = $sw; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function build_month_days($month, $number_of_days) {\r\n $days_of_month_html = '<tr class=\"week-day\">';\r\n \r\n $days_in_week = 1;\r\n for ($days = 1; $days <= $number_of_days; $days++) {\r\n\r\n // Split the weeks in rows\r\n if ($days_in_week == 8) {\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n $days_of_month_html = $days_of_month_html . '<tr class=\"week-day\">'; \r\n $days_in_week = 1;\r\n }\r\n\r\n // Render days of week in the correct position\r\n if ($days == 1) {\r\n $initial_position = get_first_day($month);\r\n for($i = 1; $i < $initial_position; $i++) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\"></td>';\r\n $days_in_week++;\r\n }\r\n if ($initial_position == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>';\r\n }\r\n } else if ($days_in_week == 1) {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day sunday\">'.$days.'</td>';\r\n } else {\r\n $days_of_month_html = $days_of_month_html . '<td class=\"day\">'.$days.'</td>'; \r\n }\r\n\r\n $days_in_week++;\r\n }\r\n $days_of_month_html = $days_of_month_html . '</tr>';\r\n \r\n return $days_of_month_html;\r\n }", "public function enableNonMonthDays() {\n\t\t$this->displayNonMonthDays = true;\n\t}", "private function _showDay($cellNumber){\n \n if($this->thisDay==0){\n \n $firstDayOfTheWeek = date('N',strtotime($this->thisYear.'-'.$this->thisMonth.'-01'));\n \n if(intval($cellNumber) == intval($firstDayOfTheWeek)){\n \n $this->thisDay=1;\n \n }\n }\n \n if( ($this->thisDay!=0)&&($this->thisDay<=$this->daysInMonth) ){\n \n $this->thisDate = date('Y-m-d',strtotime($this->thisYear.'-'.$this->thisMonth.'-'.($this->thisDay)));\n \n $cellContent = $this->thisDay;\n \n $this->thisDay++; \n \n }else{\n \n $this->thisDate =null;\n \n $cellContent=null;\n }\n \n \n return '<li id=\"li-'.$this->thisDate.'\" class=\"'.($cellNumber%7==1?' start ':($cellNumber%7==0?' end ':' ')).\n ($cellContent==null?'mask':'').'\">'.$cellContent.'</li>';\n }", "function showPostWeekColumn() {\n\t\tif (func_num_args()) {\n\t\t\tswitch ((bool) func_get_arg(0)) {\n\t\t\t\tcase true:\n\t\t\t\t\t$this->_showPostWeekColumn = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$this->_showPostWeekColumn = false;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse return (($this->_showPostWeekColumn) ? 1 : 0);\n\t}", "function showPreWeekColumn() {\n\t\tif (func_num_args()) {\n\t\t\tswitch ((bool) func_get_arg(0)) {\n\t\t\t\tcase true:\n\t\t\t\t\t$this->_showPreWeekColumn = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$this->_showPreWeekColumn = false;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse return (($this->_showPreWeekColumn) ? 1 : 0);\n\t}", "private function _showDay ($cellNumber)\n {\n if ($this->currentDay == 0)\n {\n $firstDayOfTheWeek = date('N', strtotime( $this->currentYear.'-'.$this->currentMonth.'-01'));\n\n if (intval($cellNumber) == intval($firstDayOfTheWeek)) $this->currentDay = 1;\n }\n\n if (($this->currentDay != 0) && ($this->currentDay <= $this->daysInMonth))\n {\n $this->currentDate = date('Y-m-d', strtotime( $this->currentYear.'-'.$this->currentMonth.'-'.($this->currentDay)));\n $cellContent = $this->currentDay;\n $this->currentDay ++;\n }\n else\n {\n $this->currentDate = null;\n $cellContent = null;\n }\n return $cellContent;\n }", "function mkWeekDays(){\n\tif ($this->startOnSun){\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=0;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t}\n\telse{\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=1;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName(0).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t\t$this->firstday=$this->firstday-1;\n\t\tif ($this->firstday<0) $this->firstday=6;\n\t}\nreturn $out;\n}", "private function getWeekDays()\n {\n $time = date('Y-m-d', strtotime($this->year . '-' . $this->month . '-' . $this->day));\n if ($this->view == 'week') {\n $sunday = strtotime('last sunday', strtotime($time . ' +1day'));\n $day = date('j', $sunday);\n $startingDay = date('N', $sunday);\n $cnt = 6;\n }\n if ($this->view == 'day') {\n $day = $this->day;\n $cnt = 0;\n }\n\n $this->week_days = array();\n $mlen = $this->daysMonth[intval($this->month) - 1];\n if ($this->month == 2 && ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)))) {\n $mlen = $mlen + 1;\n }\n $h = \"<tr class='\" . $this->labelsClass . \"'>\";\n $h .= \"<td>&nbsp;</td>\";\n for ($j = 0; $j <= $cnt; $j++) {\n $cs = $cnt == 0 ? 3 : 1;\n $h .= \"<td colspan='$cs'>\";\n if ($this->view == 'day') {\n $getDayNumber = date('w', strtotime($time));\n } else {\n $getDayNumber = $j;\n }\n if ($day <= $mlen) {\n } else {\n $day = 1;\n }\n $h .= $this->dayLabels[$getDayNumber] . ' ';\n $h .= intval($day);\n $this->week_days[] = $day;\n $day++;\n $h .= \"</td>\";\n }\n\n $h .= \"</tr>\";\n return $h;\n }", "function setFirstWeekDay($daynum){\n\tif ($daynum==0) $this->startOnSun=true;\n\telse $this->startOnSun=false;\n}", "function MakeCalendarGrid(){\n //get our days\n $intMonthDays = cal_days_in_month(CAL_GREGORIAN, $this->intMonth, $this->intYear);\n $intDayCounter = 0;\n $arrMonthAttributes = array('colspan'=>'7');\n //make our parent calendar table\n $objCalendarParent = $this->objCalendar->AddChildNode($this->objCalendar->objHTML,'', 'table');\n //let's make our header\n $objHeaderRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n //establish our base attributes\n for($intWeekDay=0;$intWeekDay<7;$intWeekDay++){\n $strDay = date('l', strtotime(\"Sunday +{$intWeekDay} days\"));\n $this->objCalendar->AddChildNode($objHeaderRow,$strDay, 'th',array('class'=>'weekday'));\n }\n //get the starting date\n $intMonthStart = date('N', strtotime($this->intYear.'-'.$this->intMonth.'-1'));\n $intMonthStart++;\n //avoid empty rows\n if($intMonthStart == 8)\n $intMonthStart = 1;\n //make our days now\n for($intDay=1;$intDay<($intMonthDays + $intMonthStart);$intDay++){\n $arrDateAttributes = array('onclick'=>'SelectDay(this);');\n if($intDayCounter === 0){\n //make our new week\n $objWeekRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n $arrDateAttributes['class'] = 'calendarday weekend';\n }\n else if($intDayCounter === 6)\n $arrDateAttributes['class'] = 'calendarday weekend';\n else if($intDay == date('j'))\n $arrDateAttributes['class'] = 'calendarday today';\n else\n $arrDateAttributes['class'] = 'calendarday weekday';\n $intDayCounter++;\n //reset our week now\n if($intDayCounter == 7)\n $intDayCounter = 0;\n if($intDay < $intMonthStart){\n unset($arrDateAttributes['onclick']);\n $this->objCalendar->AddChildNode($objWeekRow,'&nbsp;', 'td',$arrDateAttributes);\n continue 1;\n }\n $arrDateAttributes['id'] = ($intDay - ($intMonthStart - 1)).'-'.$this->arrCalendarProperties['calendarid'];\n //make our day now\n $this->objCalendar->AddChildNode($objWeekRow,($intDay - ($intMonthStart - 1)), 'td',$arrDateAttributes);\n }\n return TRUE;\n }", "private function makeHTMLIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$style = 'class=\"normalDay\"';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$style = 'class=\"weekendDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$style = 'class=\"currentDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->calWeekDays .= \"\\t</tr>\\n\\t<tr>\\n\";\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t}\n\n\t\t\t// Draw days\n\t\t\t$this->calWeekDays .= \"\\t\\t<td valign=\\\"top\\\" \".$style.'>'.$this->dayOfMonth;\n\t\t\t\n\t\t\tif($this->addWeekDay) {\n\t\t\t\t$this->calWeekDays .= \"|\".$this->weekDayNum;\n\t\t\t}\n\t\t\t\n\t\t\tif(strlen($this->addEvtDest) > 0) {\n\t\t\t\t$addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src=\"'.$this->addEvtImg.'\" class=\"addevtimg\" />' : '+');\n\t\t\t\t$this->calWeekDays .= '[<a href=\"'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'\" title=\"Add Event\" class=\"addevt\">'.$addevtimg.'</a>]';\n\t\t\t}\n\t\t\t\n\t\t\t$this->calWeekDays .= \" \".$this->makeDayEventListHTML().\"</td>\\n\";\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "private function setDayNames()\n\t{\n\t $range = range(1,7);\n\t $return = array();\n\t foreach($range AS $key => $dayNum)\n\t {\n\t \t$fmt = datefmt_create ($this->locale, null, null, null, IntlDateFormatter::GREGORIAN, 'eee');\n\t \t$key = strtolower(datefmt_format( $fmt , mktime(12,0,0,4,$dayNum+5,2014))); //we force the date so things start on Sunday\n\t \t\n\t \t$fmt = datefmt_create ($this->locale, null, null, null, IntlDateFormatter::GREGORIAN, 'EEEE');\n\t \t$return[$key] = datefmt_format( $fmt , mktime(12,0,0,4,$dayNum+5,2014));\n\t }\n\n\t return $return;\n\t}", "public function weekdayControl(){\n\t\t$weekday = date('w', time());\n\t\t//remakes $weekday to the weekdays name\n\t\tswitch($weekday){\n\t\t\tcase 0:\t$weekday = \"Söndag\"; break;\n\t\t\tcase 1:\t$weekday = \"Måndag\"; break;\n\t\t\tcase 2:\t$weekday = \"Tisdag\"; break;\t\n\t\t\tcase 3:\t$weekday = \"Onsdag\"; break;\n\t\t\tcase 4:\t$weekday = \"Torsdag\";break;\n\t\t\tcase 5:\t$weekday = \"Fredag\"; break;\n\t\t\tcase 6:\t$weekday = \"Lördag\"; break;\n\t\t}\t\t\t\n\t\t\n\t\treturn $weekday; \n\t}", "public function disableNonMonthDays() {\n\t\t$this->displayNonMonthDays = false;\n\t}", "function mkDays ($numDays, $month, $year) {\n for ($i = 1; $i <= $numDays; $i++) {\n $eachDay[$i] = $i; \n }\n foreach($eachDay as $day => &$wkday) {\n $wkday = date(\"w\", mktime(0,0,0,$month,$day,$year));\n }\n foreach($eachDay as $day=>&$wkday) {\n echo \"<table class='box' id=$day month=$month year=$year>\";\n echo \"<td>\";\n echo $day;\n echo \"</td>\";\n echo \"</table>\";\n }\n }", "public static function week_calendar($day, $month, $year) {\r\n global $langNoEvents, $langDay, $langWeek, $langMonth, $langViewShow;\r\n\r\n $calendar_content = \"\";\r\n if (is_null($day)) {\r\n $day = 1;\r\n }\r\n $nextweekdate = new DateTime(\"$year-$month-$day\");\r\n $nextweekdate->add(new DateInterval('P1W'));\r\n $previousweekdate = new DateTime(\"$year-$month-$day\");\r\n $previousweekdate->sub(new DateInterval('P1W'));\r\n\r\n $thisweekday = new DateTime(\"$year-$month-$day\");\r\n $difffromMonday = ($thisweekday->format('w') == 0)? 6:$thisweekday->format('w')-1;\r\n $monday = $thisweekday->sub(new DateInterval('P'.$difffromMonday.'D')); //Sunday->1, ..., Saturday->7\r\n $weekdescription = ucfirst(format_locale_date($monday->getTimestamp()));\r\n $sunday = $thisweekday->add(new DateInterval('P6D'));\r\n $weekdescription .= ' - '.ucfirst(format_locale_date($sunday->getTimestamp()));\r\n $cursorday = $thisweekday->sub(new DateInterval('P6D'));\r\n\r\n $backward = array('day'=>$previousweekdate->format('d'), 'month'=>$previousweekdate->format('m'), 'year' => $previousweekdate->format('Y'));\r\n $foreward = array('day'=>$nextweekdate->format('d'), 'month'=>$nextweekdate->format('m'), 'year' => $nextweekdate->format('Y'));\r\n\r\n $calendar_content .= '<div class=\"right\" style=\"width:100%\">'.$langViewShow.':&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_day(selectedday, selectedmonth, selectedyear);return false;\">'.$langDay.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_week(selectedday, selectedmonth, selectedyear);return false;\">'.$langWeek.'</a>&nbsp;|&nbsp;'.\r\n '<a href=\"#\" onclick=\"show_month(selectedday, selectedmonth, selectedyear);return false;\">'.$langMonth.'</a></div>';\r\n\r\n $calendar_content .= \"<table class='table-default'>\";\r\n $calendar_content .= \"<tr>\";\r\n $calendar_content .= '<td width=\"25\"><a href=\"#\" onclick=\"show_week('.$backward['day'].','.$backward['month'].','.$backward['year'].'); return false;\">&laquo;</a></td>';\r\n $calendar_content .= \"<td class='center'><b>$weekdescription</b></td>\";\r\n $calendar_content .= '<td width=\"25\" class=\"right\"><a href=\"#\" onclick=\"show_week('.$foreward['day'].','.$foreward['month'].','.$foreward['year'].'); return false;\">&raquo;</a></td>';\r\n $calendar_content .= \"</tr>\";\r\n $calendar_content .= \"</table>\";\r\n $eventlist = Calendar_Events::get_calendar_events(\"week\", \"$year-$month-$day\");\r\n\r\n $calendar_content .= \"<table class='table-default'>\";\r\n\r\n $curday = 0;\r\n $now = getdate();\r\n $today = new DateTime($now['year'].'-'.$now['mon'].'-'.$now['mday']);\r\n $curstartddate = \"\";\r\n foreach ($eventlist as $thisevent) {\r\n if ($curstartddate != $thisevent->startdate) { //event date changed\r\n $thiseventdatetime = new DateTime($thisevent->startdate);\r\n while($cursorday < $thiseventdatetime) {\r\n if ($cursorday == $today)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst(format_locale_date($cursorday->getTimestamp())) . \"</b></td></tr>\";\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n $cursorday->add(new DateInterval('P1D'));\r\n $curday++;\r\n }\r\n if ($thiseventdatetime == $today)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst(format_locale_date(strtotime($thisevent->startdate))) . \"</b></td></tr>\";\r\n if ($cursorday <= $thiseventdatetime) {\r\n $cursorday->add(new DateInterval('P1D'));\r\n $curday++;\r\n }\r\n }\r\n $calendar_content .= Calendar_Events::week_calendar_item($thisevent, 'even');\r\n $curstartddate = $thisevent->startdate;\r\n }\r\n /* Fill with empty days*/\r\n for($i=$curday;$i<7;$i++) {\r\n if ($cursorday == $today)\r\n $class = 'today';\r\n else\r\n $class = 'monthLabel';\r\n $calendar_content .= \"<tr><td colspan='3' class='$class'>\" . \"&nbsp;<b>\" . ucfirst(format_locale_date($cursorday->getTimestamp())) . \"</b></td></tr>\";\r\n $calendar_content .= \"<tr><td colspan='3'>$langNoEvents</td></tr>\";\r\n $cursorday->add(new DateInterval('P1D'));\r\n }\r\n $calendar_content .= \"</table>\";\r\n /* Legend */\r\n $calendar_content .= Calendar_Events::calendar_legend();\r\n\r\n return $calendar_content;\r\n }", "private function startMonthSpacers()\n\t{\n\t\tif($this->firstDayOfTheMonth != '0') {\n\t\t\t$this->calWeekDays .= \"\\t\\t<td colspan=\\\"\".$this->firstDayOfTheMonth.\"\\\" class=\\\"spacerDays\\\">&nbsp;</td>\\n\";\n\t\t\t$this->outArray['firstday'] = $this->firstDayOfTheMonth;\n\t\t}\n\t}", "public function bindWeekdays(): void\n {\n if ($this->getFrequencyType() === FrequencyTypeEnum::WEEK) {\n $this->setRepeatIn(\n array_map(\n fn ($weekday) => $weekday instanceof WeekdayEnum\n ? $weekday\n : WeekdayEnum::from($weekday),\n $this->getRepeatIn()\n )\n );\n }\n }", "Public static function displayCalender($array)\n {\n echo \"Sun Mon Tue Wed Thu Fri Sat\\n\";\n for ($i = 0; $i < 6; $i++) \n {\n for ($j = 0; $j < 7; $j++) \n {\n if ($array[$i][$j] == '-' || $array[$i][$j] > 31) \n {\n //replacing with spaces\n echo \" \";\n } \n else \n {\n if ($array[$i][$j] < 10) \n {\n //giving 5 space after single digit\n echo $array[$i][$j] . \" \";\n } \n else \n {\n //giving 4 space after two digit number\n echo $array[$i][$j] . \" \";\n }\n }\n }\n echo \"\\n\";\n }\n }", "private function formatDay($num)\n {\n if ($num == 0) {\n return \"Mon\";\n } else if ($num == 1) {\n return \"Tue\";\n } else if ($num == 2) {\n return \"Wed\";\n } else if ($num == 3) {\n return \"Thu\";\n } else if ($num == 4) {\n return \"Fri\";\n } else if ($num == 5) {\n return \"Sat\";\n } else if ($num == 6) {\n return \"Sun\";\n }\n return $num;\n }", "function calendar_week_mod($num)\n {\n }", "function the_weekday()\n {\n }", "public function get_weekday($weekday_number)\n {\n }", "public function showWeekNumber(): self\n {\n $this->attributes(['showWeekNumber' => true]);\n return $this;\n }", "protected function compileWeeks()\n\t{\n\t\t$intDaysInMonth = date('t', $this->Date->monthBegin);\n\t\t$intFirstDayOffset = date('w', $this->Date->monthBegin) - $this->cal_startDay;\n\n\t\tif ($intFirstDayOffset < 0)\n\t\t{\n\t\t\t$intFirstDayOffset += 7;\n\t\t}\n\n\t\t$intColumnCount = -1;\n\t\t$intNumberOfRows = ceil(($intDaysInMonth + $intFirstDayOffset) / 7);\n\t\t$arrAllEvents = $this->getAllEvents($this->iso_arrEventIDs, $this->cal_calendar, $this->Date->monthBegin, $this->Date->monthEnd);\n\t\t\n\t\t$arrDays = array();\n\n\t\t// Compile days\n\t\tfor ($i=1; $i<=($intNumberOfRows * 7); $i++)\n\t\t{\n\t\t\t$intWeek = floor(++$intColumnCount / 7);\n\t\t\t$intDay = $i - $intFirstDayOffset;\n\t\t\t$intCurrentDay = ($i + $this->cal_startDay) % 7;\n\n\t\t\t$strWeekClass = 'week_' . $intWeek;\n\t\t\t$strWeekClass .= ($intWeek == 0) ? ' first' : '';\n\t\t\t$strWeekClass .= ($intWeek == ($intNumberOfRows - 1)) ? ' last' : '';\n\n\t\t\t$strClass = ($intCurrentDay < 2) ? ' weekend' : '';\n\t\t\t$strClass .= ($i == 1 || $i == 8 || $i == 15 || $i == 22 || $i == 29 || $i == 36) ? ' col_first' : '';\n\t\t\t$strClass .= ($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) ? ' col_last' : '';\n\n\t\t\t// Empty cell\n\t\t\tif ($intDay < 1 || $intDay > $intDaysInMonth)\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = '&nbsp;';\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days empty' . $strClass ;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$intKey = date('Ym', $this->Date->tstamp) . ((strlen($intDay) < 2) ? '0' . $intDay : $intDay);\n\t\t\t$strClass .= ($intKey == date('Ymd')) ? ' today' : '';\n\n\t\t\t// Mark the selected day (see #1784)\n\t\t\tif ($intKey == $this->Input->get('day'))\n\t\t\t{\n\t\t\t\t$strClass .= ' selected';\n\t\t\t}\n\n\t\t\t// Inactive days\n\t\t\tif (empty($intKey) || !isset($arrAllEvents[$intKey]))\n\t\t\t{\n\t\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days' . $strClass;\n\t\t\t\t$arrDays[$strWeekClass][$i]['events'] = array();\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$arrEvents = array();\n\n\t\t\t// Get all events of a day\n\t\t\tforeach ($arrAllEvents[$intKey] as $v)\n\t\t\t{\n\t\t\t\tforeach ($v as $vv)\n\t\t\t\t{\n\t\t\t\t\t$arrEvents[] = $vv;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$arrDays[$strWeekClass][$i]['label'] = $intDay;\n\t\t\t$arrDays[$strWeekClass][$i]['class'] = 'days active' . $strClass;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['href'] = $this->strUrl . ($GLOBALS['TL_CONFIG']['disableAlias'] ? '?id=' . $this->Input->get('id') . '&amp;' : '?') . 'day=' . $intKey;\n\t\t\t\n\t\t\t$arrDays[$strWeekClass][$i]['title'] = sprintf(specialchars($GLOBALS['TL_LANG']['MSC']['cal_events']), count($arrEvents));\n\t\t\t$arrDays[$strWeekClass][$i]['events'] = $arrEvents;\n\t\t}\n\n\t\treturn $arrDays;\n\t}", "function enableWeekNum($title=\"\",$link=false,$javaScript=false){\n// checking before enabling, as week number calulation works only if php version > 4.1.0 [php function: date (\"W\")]\n\tif (is_integer($this->getWeekNum($this->actday))){\n\t\t$this->weekNum=true;\n\t\t$this->weekNumTitle=$title;\n\t\t$this->monthSpan++;\n\t\tif ($link) $this->weekUrl=$link;\n\t\telseif ($javaScript) $this->javaScriptWeek=$javaScript;\n\t}\n}", "function print_calendar($mon,$year)\n\t{\n\t\tglobal $dates, $first_day, $start_day;\n\t\t\t$cellWidth =\"150\";\n\t\t$first_day = mktime(0,0,0,$mon,1,$year);\n\t\t$start_day = date(\"w\",$first_day);\n\t\t$res = getdate($first_day);\n\t\t$month_name = $res[\"month\"];\n\t\t$no_days_in_month = date(\"t\",$first_day);\n\t\t\n\t\t//If month's first day does not start with first Sunday, fill table cell with a space\n\t\tfor ($i = 1; $i <= $start_day;$i++)\n\t\t\t$dates[1][$i] = \" \";\n\n\t\t$row = 1;\n\t\t$col = $start_day+1;\n\t\t$num = 1;\n\t\twhile($num<=31)\n\t\t\t{\n\t\t\t\tif ($num > $no_days_in_month)\n\t\t\t\t\t break;\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$dates[$row][$col] = $num;\n\t\t\t\t\t\tif (($col + 1) > 7)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$row++;\n\t\t\t\t\t\t\t\t$col = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$col++;\n\t\t\t\t\t\t$num++;\n\t\t\t\t\t}//if-else\n\t\t\t}//while\n\t\t$mon_num = date(\"n\",$first_day);\n\t\t$temp_yr = $next_yr = $prev_yr = $year;\n\n\t\t$prev = $mon_num - 1;\n\t\t$next = $mon_num + 1;\n\n\t\t//If January is currently displayed, month previous is December of previous year\n\t\tif ($mon_num == 1)\n\t\t\t{\n\t\t\t\t$prev_yr = $year - 1;\n\t\t\t\t$prev = 12;\n\t\t\t}\n \n\t\t//If December is currently displayed, month next is January of next year\n\t\tif ($mon_num == 12)\n\t\t\t{\n\t\t\t\t$next_yr = $year + 1;\n\t\t\t\t$next = 1;\n\t\t\t}\n\n\t\techo \"<DIV ALIGN='center'><TABLE BORDER=1 WIDTH=1600px CELLSPACING=0 BORDERCOLOR='silver'>\";\n\n\t\techo \t\"\\n<TR ALIGN='center'><TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$prev&year=$prev_yr' STYLE=\\\"text-decoration: none\\\"><B><<</B></A> </TD>\".\n\t\t\t \"<TD COLSPAN=5 BGCOLOR='#99CCFF'><B>\".date(\"F\",$first_day).\" \".$temp_yr.\"</B></TD>\".\n\t\t\t \"<TD BGCOLOR='white'> \".\n\t\t\t \"<A HREF='index.php?month=$next&year=$next_yr' STYLE=\\\"text-decoration: none\\\"><B>>></B></A> </TD></TR>\";\n\n\t\techo \"\\n<TR ALIGN='center'><TD width='$cellWidth'><B>Domenica</B></TD><TD width='$cellWidth'><B>Lunedi</B></TD><TD width='$cellWidth'><B>Martedi</B></TD>\";\n\t\techo \"<TD width='$cellWidth'><B>Mercoledi</B></TD><TD width='$cellWidth'><B>Giovedi</B></TD><TD width='$cellWidth'><B>Venerdi</B></TD><TD width='$cellWidth'><B>Sabato</B></TD></TR>\";\n\t\techo \"<TR><TD COLSPAN=7> </TR><TR height='100px;' ALIGN='center'>\";\n\t\t\t\t\n\t\t$end = ($start_day > 4)? 6:5;\n\t\tfor ($row=1;$row<=$end;$row++)\n\t\t\t{\n\t\t\t\tfor ($col=1;$col<=7;$col++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($dates[$row][$col] == \"\")\n\t\t\t\t\t\t$dates[$row][$col] = \" \";\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!strcmp($dates[$row][$col],\" \"))\n\t\t\t\t\t\t\t$count++;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$t = $dates[$row][$col];\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//If date is today, highlight it\n\t\t\t\t\t\tif (($t == date(\"j\")) && ($mon == date(\"n\")) && ($year == date(\"Y\"))){\n\t\t\t\t\t\t\techo \"\\n<TD valign='top' BGCOLOR='aqua'><a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\";\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n }\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t//If the date is absent ie after 31, print space\n\t\t\t\t\t\t\techo \"\\n<TD valign='top'>\".(($t == \" \" )? \"&nbsp;\" : \"<a onclick=\\\"NewWindow(this.href,'pg_center','780','670','no');return false;\\\" href='calendar_add_event.php?azione=add&gg=$t&mm=$mon&yyyy=$year'>\".$t.\"</a>\");\n echo '<div align=\"left\">';\n echo stampa_appuntamenti($t,$mon,$year,$_SESSION['id_utente']);\n echo '</div>';\n echo \"</TD>\";\n\t\t\t\t\t }\n }// for -col\n\t\t\t\t\n\t\t\t\tif (($row + 1) != ($end+1))\n\t\t\t\t\techo \"</TR>\\n<TR ALIGN='center' height='100px;'>\";\n\t\t\t\telse\n\t\t\t\t\techo \"</TR>\";\n\t\t\t}// for - row\n\t\techo \"\\n</TABLE><BR><BR><A HREF=\\\"index.php\\\">Visualizza mese corrente</A> </DIV>\";\n\t}", "public function weekdays()\n {\n return $this->spliceIntoPosition(5, '1-5');\n }", "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}", "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}" ]
[ "0.6188181", "0.6141272", "0.61172116", "0.59556955", "0.5809905", "0.58070767", "0.5771572", "0.5708788", "0.5641808", "0.5629857", "0.5550392", "0.5475904", "0.54352045", "0.53517", "0.5329178", "0.53151584", "0.53131", "0.53094345", "0.529378", "0.52783984", "0.52555025", "0.5235777", "0.5234004", "0.5185547", "0.5157969", "0.51486385", "0.5141414", "0.5132667", "0.51214105", "0.5117174" ]
0.62755215
0
Generic method to output the calendar Outputs the calendar as an array
public function drawArray() { $this->outArray['days'] = array(); $this->makeCalendarTitle(); $this->makeCalendarHead(); $this->makeDayHeadings(); $this->startMonthSpacers(); $this->makeArrayIterator(); $this->endMonthSpacers(); return $this->outArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CalendarData($month=null, $year=null) {\n if (is_null($year)) $year = date('Y');\n if (is_null($month)) $month = date('n');\n\n // RENDER\n exec(\"cal \".$month.\" \". $year, $cal); $this->dbgMsg( ' ### calendar '.$month.\" \". $year.\" :: \", $cal );\n $rxp[] = array_fill(0,7,' ');\n for ($k=2; $k < count($cal); $k++ ) {\n $xpl = explode(' ', trim( preg_replace('{\\s+}i', ' ', $cal[$k]) ) );\n if (count($xpl) && $xpl[0]!=='' ) { // $this->dbgMsg(' xploded row', $xpl, 1,1 );\n if ( $wsp=7-count($xpl) ) {\n if ($k==2) $rx = array_merge( array_fill(0, $wsp, ' ' ), $xpl );\n else $rx = array_merge( $xpl, array_fill(count($xpl)+1, $wsp, ' ' ) );\n }\n else $rx = $xpl;\n $rxp[] = $rx;\n }\n }\n\n for ($j=1; $j < count($rxp); $j++ ) {\n for ($d=0; $d<7; $d++) {\n if ($d===0) $rxp[$j-1][6] = $rxp[$j][0];\n else $rxp[$j][$d-1] = $rxp[$j][$d];\n }\n }\n $rxp[$j-1][$d-1]=' ';\n foreach ($rxp as $j=>$r) { // $this->dbgMsg( \"str_replace(' ','',implode('',\".$rxp[$j].\") )\", str_replace(' ','',implode('',$rxp[$j]) ) );\n if ( !str_replace(' ','',implode('',$rxp[$j]) ) ) unset($rxp[$j]); // NEED FOR TESTS\n } // $this->dbgMsg(' exploded calendar : ', $rxp, 1,1 );\n\n foreach ( $rxp as $i=>$arr ) {\n foreach ( $arr as $k=>$day) {\n $clr = array();\n if ( is_numeric($day) ) { // $this->dbgMsg( 'CalDay is_numeric( '.$day.' ) ', 'YES' );\n $Mm = $month<10?('0'.$month):$month;\n $Dd = $day<10?('0'.$day):$day;\n $key_date = $year.'-'.$Mm.'-'.$Dd; // $href_date = $year.'/'.$Mm.'/'.$Dd;\n $clauses = array();\n $clauses[] = \"'\".$key_date.\"' >= s.`date_start` and '\".$key_date.\"' <= s.`date_stop`\";\n $clauses[] = \"s.`status`<>'closed'\"; // $this->dbgMsg('', $clauses );\n $sql = $this->sql10.\" where \".implode(' and ', $clauses);\n $a = $this->db->sql2array( $sql ); // $this->dbgMsg(\" cal Day :: \".$sql, $a ); // выборка фильм+площадка+сеанс\n\n if ( $key_date == $this->guide->uri_parts[1] ) {\n $clr['tpl'] = '_Curr';\n $clr['Misc'] = ' style=\"color:#333;\"';\n // } elseif ( !empty($a) ) { // так - со ссылками в прошлое\n } elseif ( !empty($a) && date(\"Y-m-d\") <= $key_date ) {\n $clr['tpl'] = '_Href';\n $clr['DayHref']= 'film/'.$key_date.'/';\n if ( $k>4 ) $clr['Misc'] = ' style=\"color:#990000;\"';\n } else {\n $clr['tpl'] = '_Item';\n }\n }\n $clr['DayNum']=$day;\n $rxp[$i][$k] = $this->tpl->ParseOne( $clr, $this->tpf.':CalDay'.$clr['tpl'], '' );\n } // $rxp[$i]['trMisc'] = ' style=\"'.(($i%2==1)?'background:#eee;\"':'\"');\n $rxp[$i]['tdMisc'] = ' style=\"text-align:right;background-color:#ffffff;color:#ccc;\"';\n } // $this->dbgMsg('EXPANDED calendar : ', $rxp, 1,1 );\n return $rxp;\n }", "private function _get_calendar_array()\n\t{\n\t $this->all_events = $this->result->xpath(\".//event\");\n\t \n\t foreach($this->all_events as $an_event):\n\t $start_at = $an_event->xpath(\"./start-at\");\n \t $start_at = $start_at[0];\n \t $end_at = $an_event->xpath(\"./end-at\");\n \t $end_at = $end_at[0];\n \t \n \t $start_at = new DateTime($start_at);\n \t $start_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $start_at->setTime(0, 0, 0);\n \t $end_at = new DateTime($end_at);\n \t $end_at->setTimezone(new DateTimeZone('America/Chicago'));\n \t $end_at->setTime(0, 0, 0);\n \t \n \t $start_timestamp = strtotime($start_at->format('Y-m-d'));\n $end_timestamp = strtotime($end_at->format('Y-m-d'));\n \n $start_year = date(\"Y\", $start_timestamp);\n $end_year = date(\"Y\", $end_timestamp);\n $start_month = date(\"m\", $start_timestamp);\n $end_month = date(\"m\", $end_timestamp);\n $start_day = date(\"d\", $start_timestamp);\n $start_day = $start_day + 1;\n $end_day = date(\"d\", $end_timestamp);\n $end_day = $end_day + 1;\n \n if(($start_year == $this->year && $start_month == $this->month) || ($end_year == $this->year && $end_month == $this->month)):\n if($start_year == $end_year):\n if($start_month == $end_month):\n $this->_calendar_array_one($start_day, $end_day);\n else:\n if($end_month != $this->month):\n $this->_calendar_array_two($start_day);\n else:\n $this->_calendar_array_three($end_day);\n endif;\n endif;\n endif;\n endif;\n endforeach;\n \n\t foreach($this->callinks as $callinks):\n\t foreach($callinks as $key => $value):\n\t $this->combined_callinks[\"$key\"] = $value;\n\t endforeach;\n\t endforeach;\n\t}", "protected function build_calendar()\n\t{\n\t\t//ee()->TMPL->log_item('Calendar: Building calendar output');\n\n\t\t$disable\t= array(\n\t\t\t'categories',\n\t\t\t'category_fields',\n\t\t\t'custom_fields',\n\t\t\t'member_data',\n\t\t\t'pagination',\n\t\t\t'trackbacks'\n\t\t);\n\n\t\t$this->CDT->reset();\n\t\t$today_ymd\t= $this->CDT->ymd;\n\n\t\t// -------------------------------------\n\t\t// Set dynamic=\"off\", lest Channel get uppity and try\n\t\t// to think that it's in charge here.\n\t\t// -------------------------------------\n\n\t\t//default off.\n\t\tif ( $this->check_yes( ee()->TMPL->fetch_param('dynamic') ) )\n\t\t{\n\t\t\tee()->TMPL->tagparams['dynamic'] \t= 'yes';\n\t\t}\n\t\telse\n\t\t{\n\t\t\tee()->TMPL->tagparams['dynamic'] \t= 'no';\n\t\t}\n\n\t\tif (isset(ee()->TMPL->tagparams['category']))\n\t\t{\n\t\t\t$this->convert_category_titles();\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Collect important bits of tagdata\n\t\t// -------------------------------------\n\n\t\t//ee()->TMPL->log_item('Calendar: Collecting tagdata');\n\n\t\t$output_at\t= '';\n\t\t$tagdata\t= ee()->TMPL->tagdata;\n\t\t$each_year\t= $each_month = $each_week = $each_day = $each_hour = $each_event = '';\n\t\t$hash_event\t= 'd38bf16a9a74c63fa5eb6d1ac082d539'.\"\\n\";\n\t\t$hash_hour\t= 'fe16402ccfad7e120a7ca3a31df3a019'.\"\\n\";\n\t\t$hash_day\t= '2aa2a1a0724182b1d876232c137a6d4f'.\"\\n\";\n\t\t$hash_week\t= 'b657210371b3e2a6f955ef6a404689de'.\"\\n\";\n\t\t$hash_month\t= 'd03207661c36a3bfd43b9dd239e41676'.\"\\n\";\n\t\t$hash_year\t= '97a92770ab082652cf662bdacc311dff'.\"\\n\";\n\n\t\t//--------------------------------------------\n\t\t//\tremove pagination before we start\n\t\t//--------------------------------------------\n\n\t\t//has tags?\n\t\tif (preg_match(\n\t\t\t\t\"/\" . LD . \"calendar_paginate\" . RD .\n\t\t\t\t\t\"(.+?)\" .\n\t\t\t\tLD . preg_quote(T_SLASH, '/') . \"calendar_paginate\" . RD . \"/s\",\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t))\n\t\t{\n\t\t\t$this->paginate_tagpair_data\t= $match[0];\n\t\t\t$tagdata \t\t\t\t\t\t= str_replace( $match[0], '', $tagdata );\n\t\t}\n\t\t//prefix comes first\n\t\telse if (preg_match(\n\t\t\t\t\"/\" . LD . \"paginate\" . RD .\n\t\t\t\t\t\"(.+?)\" .\n\t\t\t\tLD . preg_quote(T_SLASH, '/') . \"paginate\" . RD . \"/s\",\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t))\n\t\t{\n\t\t\t$this->paginate_tagpair_data\t= $match[0];\n\t\t\t$tagdata \t\t\t\t\t\t= str_replace( $match[0], '', $tagdata );\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Replace days of the week first, cuz they're easy\n\t\t// -------------------------------------\n\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_day_of_week']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/' . LD . 'display_each_day_of_week' . RD .\n\t\t\t\t\t'(.*?)' .\n\t\t\t\tLD . preg_quote(T_SLASH, '/') . 'display_each_day_of_week' . RD . '/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$dow_output\t\t= '';\n\t\t\t\t$vars\t\t\t= array();\n\t\t\t\t$current_dow\t= $this->CDT->day_of_week;\n\n\t\t\t\t$this->CDT->change_ymd($this->P->value('date_range_start', 'ymd'));\n\n\t\t\t\tif ($this->CDT->day_of_week != $this->first_day_of_week)\n\t\t\t\t{\n\t\t\t\t\t$this->CDT->add_day(\n\t\t\t\t\t\t$this->first_day_of_week - $this->CDT->day_of_week\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tfor ($i = 0; $i < 7; $i++)\n\t\t\t\t{\n\t\t\t\t\tif ($i > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->CDT->add_day();\n\t\t\t\t\t}\n\n\t\t\t\t\t$vars['conditional'] = array(\n\t\t\t\t\t\t'day_of_week_is_weekend'\t=> (\n\t\t\t\t\t\t\t$this->CDT->day_of_week == 0 OR\n\t\t\t\t\t\t\t$this->CDT->day_of_week == 6\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'day_of_week_is_current'\t=> (\n\t\t\t\t\t\t\t$this->CDT->day_of_week == $current_dow\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t'day_of_week'\t\t\t=> $this->cdt_format_date_string($this->CDT->datetime_array(), 'l'),\n\t\t\t\t\t\t'day_of_week_one'\t\t=> $this->cdt_format_date_string($this->CDT->datetime_array(), 'b'),\n\t\t\t\t\t\t'day_of_week_short'\t\t=> $this->cdt_format_date_string($this->CDT->datetime_array(), 'D'),\n\t\t\t\t\t\t'day_of_week_N'\t\t\t=> $this->cdt_format_date_string($this->CDT->datetime_array(), 'N'),\n\t\t\t\t\t\t'day_of_week_number'\t=> $this->cdt_format_date_string($this->CDT->datetime_array(), 'w')\n\t\t\t\t\t);\n\n\t\t\t\t\t$dow_output .= $this->swap_vars($vars, $match[1]);\n\t\t\t\t}\n\t\t\t\t$tagdata = str_replace($match[0], $dow_output, $tagdata);\n\t\t\t}\n\t\t}\n\n\t\t$tagdata = trim($tagdata).\"\\n\";\n\n\t\t// -------------------------------------\n\t\t// Now the rest\n\t\t// -------------------------------------\n\n\t\tif (isset(ee()->TMPL->var_pair['events']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'events'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'events'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_event \t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_event, $tagdata);\n\t\t\t\tee()->TMPL->tagdata = $each_event;\n\t\t\t\t$output_at \t\t\t= 'event';\n\t\t\t}\n\t\t}\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_hour']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'display_each_hour'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'display_each_hour'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_hour \t\t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_hour, $tagdata);\n\t\t\t\t$output_at \t\t\t= 'hour';\n\t\t\t}\n\t\t}\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_day']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'display_each_day'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'display_each_day'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_day \t\t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_day, $tagdata);\n\t\t\t\t$output_at \t\t\t= 'day';\n\t\t\t}\n\t\t}\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_week']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'display_each_week'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'display_each_week'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_week \t\t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_week, $tagdata);\n\t\t\t\t$output_at \t\t\t= 'week';\n\t\t\t}\n\t\t}\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_month']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'display_each_month'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'display_each_month'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_month \t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_month, $tagdata);\n\t\t\t\t$output_at \t\t\t= 'month';\n\t\t\t}\n\t\t}\n\n\t\tif (isset(ee()->TMPL->var_pair['display_each_year']))\n\t\t{\n\t\t\tpreg_match(\n\t\t\t\t'/'.LD.'display_each_year'.RD.'(.*?)'.LD.preg_quote(T_SLASH, '/').'display_each_year'.RD.'/s',\n\t\t\t\t$tagdata,\n\t\t\t\t$match\n\t\t\t);\n\n\t\t\tif (isset($match[1]))\n\t\t\t{\n\t\t\t\t$each_year \t\t\t= trim($match[1]).\"\\n\";\n\t\t\t\t$tagdata \t\t\t= str_replace($match[0], $hash_year, $tagdata);\n\t\t\t\t$output_at \t\t\t= 'year';\n\t\t\t}\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// If there aren't any display_each_X var pairs, default to event\n\t\t// -------------------------------------\n\n\t\tif ($output_at == '')\n\t\t{\n\t\t\t$each_event \t= $tagdata;\n\t\t\t$tagdata \t\t= $hash_event;\n\t\t\t$output_at \t\t= 'event';\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Set the default date to the start of our range\n\t\t// -------------------------------------\n\n\t\t$start_blank = (\n\t\t\t$this->P->value('date_range_start') === FALSE AND\n\t\t\t$this->P->value('date_range_end') === FALSE\n\t\t);\n\n\t\t$start\t= $this->CDT->change_datetime(\n\t\t\t$this->P->value('date_range_start', 'year'),\n\t\t\t$this->P->value('date_range_start', 'month'),\n\t\t\t$this->P->value('date_range_start', 'day'),\n\t\t\t$this->P->value('date_range_start', 'hour'),\n\t\t\t$this->P->value('date_range_start', 'minute')\n\t\t);\n\n\t\t$end\t= $this->CDT->change_datetime(\n\t\t\t$this->P->value('date_range_end', 'year'),\n\t\t\t$this->P->value('date_range_end', 'month'),\n\t\t\t$this->P->value('date_range_end', 'day'),\n\t\t\t($start_blank ? '23' : $this->P->value('date_range_end', 'hour')),\n\t\t\t($start_blank ? '59' : $this->P->value('date_range_end', 'minute'))\n\t\t);\n\n\t\t$current_period_start\t= $start;\n\t\t$current_period_end\t\t= $end;\n\n\t\t$this->CDT->set_default($start);\n\t\t$this->CDT->reset();\n\n\t\t// -------------------------------------\n\t\t// If we are \"padding\" short weeks, modify our dates\n\t\t// -------------------------------------\n\n\t\tif ($this->P->value('pad_short_weeks') === TRUE)\n\t\t{\n\t\t\t// -------------------------------------\n\t\t\t// Adjust the start date backward to the first day of the week, if necessary\n\t\t\t// -------------------------------------\n\n\t\t\t$old_end = $end;\n\n\t\t\tif ($start['day_of_week'] != $this->first_day_of_week)\n\t\t\t{\n\t\t\t\t$offset = ($start['day_of_week'] > $this->first_day_of_week) ?\n\t\t\t\t\t$start['day_of_week'] - $this->first_day_of_week :\n\t\t\t\t\t7 - ($this->first_day_of_week - $start['day_of_week']);\n\n\t\t\t\t$start \t= $this->CDT->add_day(-$offset);\n\t\t\t\t$this->CDT->reset();\n\t\t\t}\n\n\t\t\t// -------------------------------------\n\t\t\t// Adjust the end date forward to the last day of the week, if necessary\n\t\t\t// -------------------------------------\n\n\t\t\t$last_dow = ($this->first_day_of_week > 0) ? $this->first_day_of_week - 1 : 6;\n\n\t\t\tif ($end['day_of_week'] != $last_dow)\n\t\t\t{\n\t\t\t\t$this->CDT->change_ymd($end['ymd']);\n\t\t\t\t$offset = ($end['day_of_week'] > $last_dow) ?\n\t\t\t\t\t7 - ($end['day_of_week'] - $last_dow) :\n\t\t\t\t\t$last_dow - $end['day_of_week'];\n\n\t\t\t\t$end \t= $this->CDT->add_day($offset);\n\t\t\t\t$this->CDT->reset();\n\t\t\t}\n\n\t\t\t$end['time']\t= $old_end['time'];\n\t\t\t$end['hour']\t= $old_end['hour'];\n\t\t\t$end['minute']\t= $old_end['minute'];\n\n\t\t\t$this->CDT->set_default($start);\n\t\t\t$this->P->set('date_range_start', $start);\n\t\t\t$this->P->set('date_range_end', $end);\n\t\t}\n\n\t\t//ee()->TMPL->log_item('Calendar: Date range start: '. $this->P->value('date_range_start', 'ymd'));\n\n\t\t//ee()->TMPL->log_item('Calendar: Date range end: '. $this->P->value('date_range_end', 'ymd'));\n\n\t\t// -------------------------------------\n\t\t// Let's go fetch some events\n\t\t// -------------------------------------\n\n\t\t/*$category = FALSE;\n\n\t\tif (isset(ee()->TMPL) AND\n\t\t\t is_object(ee()->TMPL) AND\n\t\t\t ee()->TMPL->fetch_param('category') !== FALSE AND\n\t\t\t ee()->TMPL->fetch_param('category') != ''\n\t\t)\n\t\t{\n\t\t\t$category = ee()->TMPL->fetch_param('category');\n\n\t\t\tunset(ee()->TMPL->tagparams['category']);\n\t\t}*/\n\n\t\t$ids \t\t\t= $this->data->fetch_event_ids($this->P /*, $category*/);\n\n\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Fetching events. ' . count( $ids ) . ' events were found.');\n\n\t\t$entry_data \t= array();\n\t\t$events \t\t= array();\n\n\t\t// -------------------------------------\n\t\t// No events? You really need to work on your social calendar...\n\t\t// -------------------------------------\n\n\t\tif (empty($ids))\n\t\t{\n\t\t\t// -------------------------------------\n\t\t\t// If they used a no_results tag, let 'em have it\n\t\t\t// -------------------------------------\n\n\t\t\tif (ee()->TMPL->no_results != '')\n\t\t\t{\n\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() No results, going home');\n\t\t\t\treturn $this->no_results();\n\t\t\t}\n\n\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() No results, but staying around for the show');\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// -------------------------------------\n\t\t\t// We only care about this stuff if:\n\t\t\t// \t* there's an {event}{/event} tag pair\n\t\t\t// \t* thar be one or more xxx_has_events variables\n\t\t\t// -------------------------------------\n\n\t\t\tif ($each_event != '' OR strpos(ee()->TMPL->tagdata, '_event_total') !== FALSE)\n\t\t\t{\n\t\t\t\twhile (TRUE)\n\t\t\t\t{\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Firing up the ol Channel Module to try and process ' . count( $ids ) . ' events.');\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Fetch occurrence info\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$occurrence_ids = $this->data->fetch_occurrence_entry_ids($ids);\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() ' . count( $occurrence_ids ) . ' occurrences were found.');\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// If the entry_id of the occurrence doesn't match the entry_id\n\t\t\t\t\t// of the entry, we need to fetch the occurrence data separately\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tforeach ($occurrence_ids as $id => $data)\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach ($data as $oid => $o_entry_id)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($id != $o_entry_id)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$ids[$o_entry_id] = $id; //$o_entry_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\t// -------------------------------------\n\t\t\t\t\t// Prepare tagdata for Calendar-specific variable pairs, which\n\t\t\t\t\t// we will process later.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tee()->TMPL->var_single['entry_id'] = 'entry_id';\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Prepare tagdata for Calendar-specific date variables, which\n\t\t\t\t\t// we will process later.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$var_dates = array(\n\t\t\t\t\t\t'event_start_date' \t=> FALSE,\n\t\t\t\t\t\t'event_start_time' \t=> FALSE,\n\t\t\t\t\t\t'event_end_date' \t=> FALSE,\n\t\t\t\t\t\t'event_end_time' \t=> FALSE\n\t\t\t\t\t);\n\n\t\t\t\t\tforeach (ee()->TMPL->var_single as $k => $v)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (($pos = strpos($k, ' format')) !== FALSE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$name = substr($k, 0, $pos);\n\n\t\t\t\t\t\t\tif (array_key_exists($name, $var_dates))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$var_dates[$name][$k] \t\t= $v;\n\t\t\t\t\t\t\t\tee()->TMPL->var_single[$k] \t= $k;\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\t//\t----------------------------------------\n\t\t\t\t\t//\tInvoke Channel class\n\t\t\t\t\t//\t----------------------------------------\n\n\t\t\t\t\tif ( ! class_exists('Channel') )\n\t\t\t\t\t{\n\t\t\t\t\t\trequire PATH_MOD.'/channel/mod.channel.php';\n\t\t\t\t\t}\n\n\t\t\t\t\t$channel = new Channel();\n\n\t\t\t\t\t//need to remove limit here so huge amounts of events work\n\t\t\t\t\t$channel->limit = 1000000;\n\n\t\t\t\t\t// --------------------------------------------\n\t\t\t\t\t// Invoke Pagination for EE 2.4 and Above\n\t\t\t\t\t// --------------------------------------------\n\n\t\t\t\t\t$channel = $this->add_pag_to_channel($channel);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Prepare parameters\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tee()->TMPL->tagparams['entry_id'] = implode('|', array_keys($ids));\n\n\t\t\t\t\tif ($this->P->value('enable') != FALSE)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (is_array($this->P->value('enable')))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tee()->TMPL->tagparams['disable'] = implode('|', array_diff($disable, $this->P->value('enable')));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tee()->TMPL->tagparams['disable'] = implode('|', array_diff($disable, array($this->P->value('enable'))));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tee()->TMPL->tagparams['disable'] = implode('|', $disable);\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Pre-process related data\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data( ee()->TMPL->tagdata );\n\n\t\t\t\t\tif (version_compare($this->ee_version, '2.6.0', '<'))\n\t\t\t\t\t{\n\t\t\t\t\t\tee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data(\n\t\t\t\t\t\t\t$each_event\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tee()->TMPL->var_single \t= array_merge( ee()->TMPL->var_single, ee()->TMPL->related_markers );\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Execute needed methods\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$channel->fetch_custom_channel_fields();\n\n\t\t\t\t\t$channel->fetch_custom_member_fields();\n\n\t\t\t\t\t// --------------------------------------------\n\t\t\t\t\t// Pagination Tags Parsed Out\n\t\t\t\t\t// --------------------------------------------\n\n\t\t\t\t\t$channel = $this->fetch_pagination_data($channel);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Querification\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//for some reason without this in EE 2.8.x\n\t\t\t\t\t//pagination has some sort of dynamic detection\n\t\t\t\t\t//that it didn't in EE 2.7 and below and hoses our\n\t\t\t\t\t//pagination setup because we are doing it\n\t\t\t\t\t//manually later as this is just data gathering\n\t\t\t\t\t//for events.\n\t\t\t\t\tif (\n\t\t\t\t\t\tversion_compare($this->ee_version, '2.8.0', '>=') &&\n\t\t\t\t\t\tisset($channel->pagination)\n\t\t\t\t\t)\n\t\t\t\t\t{\n\t\t\t\t\t\t$channel->pagination->paginate = false;\n\t\t\t\t\t}\n\n\t\t\t\t\t$channel->build_sql_query();\n\n\t\t\t\t\tif ($channel->sql == '')\n\t\t\t\t\t{\n\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Channel query empty');\n\n\t\t\t\t\t\tif (ee()->TMPL->no_results != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn $this->no_results();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$channel->query = ee()->db->query($channel->sql);\n\n\t\t\t\t\tif ($channel->query->num_rows == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Channel Module returned no results');\n\n\t\t\t\t\t\tif (ee()->TMPL->no_results != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn $this->no_results();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\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//ee()->TMPL->log_item('Calendar:build_calendar() Channel module found ' . $channel->query->num_rows . ' results.');\n\t\t\t\t\t}\n\n\t\t\t\t\t$channel->query->result\t= $channel->query->result_array();\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Trim IDs and build events\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$new_ids = array();\n\n\t\t\t\t\tforeach ($channel->query->result as $k => $row)\n\t\t\t\t\t{\n\t\t\t\t\t\t$new_ids[$row['entry_id']] = $ids[$row['entry_id']];\n\t\t\t\t\t}\n\n\t\t\t\t\t$event_data = $this->data->fetch_all_event_data($new_ids);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Turn these IDs into events\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$events = array();\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Beginning event creation process.');\n\n\t\t\t\t\tif ( ! class_exists('Calendar_event'))\n\t\t\t\t\t{\n\t\t\t\t\t\trequire_once CALENDAR_PATH.'calendar.event.php';\n\t\t\t\t\t}\n\n\t\t\t\t\t$calendars = array();\n\n\t\t\t\t\tforeach ($event_data as $k => $edata)\n\t\t\t\t\t{\n\t\t\t\t\t\t$temp = new Calendar_event(\n\t\t\t\t\t\t\t$edata,\n\t\t\t\t\t\t\t$this->P->params['date_range_start']['value'],\n\t\t\t\t\t\t\t$this->P->params['date_range_end']['value']\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( ! empty($temp->dates))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$temp->prepare_for_output();\n\t\t\t\t\t\t\t$events[$edata['entry_id']] = $temp;\n\t\t\t\t\t\t\t$calendars[$events[$edata['entry_id']]->default_data['calendar_id']] = array();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Event creation resulted in the creation of ' . count( $events ) . ' events.');\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Event creation process finished.');\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Leaving so soon?\n\t\t\t\t\t// There's no point in continuing if we're just interested\n\t\t\t\t\t// in whether or not there are events on this day.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($each_event == '')\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach (array_keys($events) as $id)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$entry_data[$id] = $id;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Skipping further channel module processing because $each_event variable was empty string. ' . count( $entry_data ) . ' events were found and logged into the $entry_data array.');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Nor should we stay around if there's nothing to process\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\telseif (empty($calendars))\n\t\t\t\t\t{\n\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Skipping further channel module processing because there were no calendars connected to the events found.');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Fetch information about the calendars\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$calendars = $this->data->fetch_calendar_data_by_id(array_keys($calendars));\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Prepare the tagdata that will be parsed by the channel module\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$blargle = '3138ad2081984be5dea40e593fd61f87';\n\t\t\t\t\t$bleegle = '6f8de301e6e6f2cd80ad99aa3a765b31';\n\t\t\t\t\t//ee()->TMPL->tagdata = $blargle . '[' . LD . \"entry_id\" . RD . ']' . $each_event . $bleegle;\n\t\t\t\t\tee()->TMPL->tagdata = $blargle .\n\t\t\t\t\t\t'[' . LD . \"entry_id\" . RD . ']' .\n\t\t\t\t\t\tee()->TMPL->tagdata .\n\t\t\t\t\t\t$bleegle;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Prep variable aliases\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$variables = array(\n\t\t\t\t\t\t'title'\t\t\t=> 'event_title',\n\t\t\t\t\t\t'url_title'\t\t=> 'event_url_title',\n\t\t\t\t\t\t'entry_id'\t\t=> 'event_id',\n\t\t\t\t\t\t'author_id'\t\t=> 'event_author_id',\n\t\t\t\t\t\t'author'\t\t=> 'event_author',\n\t\t\t\t\t\t'status'\t\t=> 'event_status'\n\t\t\t\t\t);\n\n\t\t\t\t\t//custom variables with the letters 'url' are borked in\n\t\t\t\t\t//EE 2.6. Bug reported, but this should fix.\n\t\t\t\t\t//https://support.ellislab.com/bugs/detail/19337\n\t\t\t\t\tif (version_compare($this->ee_version, '2.6.0', '>='))\n\t\t\t\t\t{\n\t\t\t\t\t\t$variables['url_title'] = 'event_borked_title';\n\n\t\t\t\t\t\tee()->TMPL->var_single['event_borked_title'] = 'event_borked_title';\n\n\t\t\t\t\t\tunset(ee()->TMPL->var_single['event_url_title']);\n\n\t\t\t\t\t\tee()->TMPL->tagdata = str_replace(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\tLD . 'event_url_title' . RD,\n\t\t\t\t\t\t\t\t'\"event_url_title\"',\n\t\t\t\t\t\t\t\t\"'event_url_title'\"\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\tLD . 'event_borked_title' . RD,\n\t\t\t\t\t\t\t\t'\"event_borked_title\"',\n\t\t\t\t\t\t\t\t\"'event_borked_title'\"\n\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tee()->TMPL->tagdata\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tee()->TMPL->var_single['event_calendar_borked_title'] = 'event_calendar_borked_title';\n\n\t\t\t\t\t\tunset(ee()->TMPL->var_single['event_calendar_url_title']);\n\n\t\t\t\t\t\tee()->TMPL->tagdata = str_replace(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\tLD . 'event_calendar_url_title' . RD,\n\t\t\t\t\t\t\t\t'\"event_calendar_url_title\"',\n\t\t\t\t\t\t\t\t\"'event_calendar_url_title'\"\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\tLD . 'event_calendar_borked_title' . RD,\n\t\t\t\t\t\t\t\t'\"event_calendar_borked_title\"',\n\t\t\t\t\t\t\t\t\"'event_calendar_borked_title'\"\n\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tee()->TMPL->tagdata\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// --------------------------------------------\n\t\t\t\t\t// Typography\n\t\t\t\t\t// --------------------------------------------\n\n\t\t\t\t\tee()->load->library('typography');\n\t\t\t\t\tee()->typography->initialize();\n\t\t\t\t\tee()->typography->convert_curly = FALSE;\n\n\t\t\t\t\t$channel->fetch_categories();\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Add variables to the query result\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tforeach ($channel->query->result as $k => $row)\n\t\t\t\t\t{\n\t\t\t\t\t\t$entry_id = $row['entry_id'];\n\n\t\t\t\t\t\t$channel->query->result[$k]['author'] = ($row['screen_name'] != '') ? $row['screen_name'] : $row['username'];\n\n\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar:build_calendar() We\\'re in the channel query result loop. Entry id is ' . $entry_id );\n\n\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t// Skip this result if the event data doesn't exist\n\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\tif (! isset($events[$ids[$entry_id]]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($channel->query->result[$k]);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$channel->query->result[$k]['edited_occurrence'] \t= FALSE;\n\t\t\t\t\t\t$channel->query->result[$k]['event_parent_id']\t\t= ($ids[$entry_id] == $entry_id) ? 0 : $ids[$entry_id];\n\n\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t// If this entry_id is not in the $events array, this is an edited occurrence\n\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\tif (! isset($events[$entry_id]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Add this info to the $events array\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$events[$entry_id] = clone $events[$ids[$entry_id]];\n\n\t\t\t\t\t\t\t$channel->query->result[$k]['edited_occurrence'] = TRUE;\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Correct the info\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\tforeach ($events[$entry_id]->occurrences as $ymd => $times)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tforeach ($times as $time => $data)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ($data['entry_id'] != $entry_id)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tunset($events[$entry_id]->occurrences[$ymd][$time], $events[$entry_id]->dates[$ymd][$time]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tunset($events[$data['event_id']]->occurrences[$ymd][$time], $events[$data['event_id']]->dates[$ymd][$time]);\n\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\n\t\t\t\t\t\t\t// NOTE: Requires PHP >= 5.1.0\n\t\t\t\t\t\t\t$events[$entry_id]->dates = array_intersect_key($events[$entry_id]->dates, $events[$entry_id]->occurrences);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t// Alias\n\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\tforeach ($variables as $old => $new)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($old == 'title')\n\t\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t\t$channel->query->result[$k][$old]\t= ee()->typography->parse_type(\n\t\t\t\t\t\t\t\t\t$channel->query->result[$k][$old],\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'text_format' \t=> 'lite',\n\t\t\t\t\t\t\t\t\t\t'html_format' \t=> 'none',\n\t\t\t\t\t\t\t\t\t\t'auto_links' \t=> 'n',\n\t\t\t\t\t\t\t\t\t\t'allow_img_url' => 'no'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$channel->query->result[$k][$new]\t= $channel->query->result[$k][$old];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$channel->query->result[$k][$new]\t= $channel->query->result[$k][$old];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t// Calendar variables\n\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\tforeach ($calendars[$events[$entry_id]->default_data['calendar_id']] as $key => $val)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$channel->query->result[$k][$key] = $val;\n\n\t\t\t\t\t\t\tif ($key == 'calendar_url_title' AND\n\t\t\t\t\t\t\t\tversion_compare($this->ee_version, '2.6.0', '>='))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$channel->query->result[$k]['event_calendar_borked_title'] = $val;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$channel->query->result[$k]['event_'.$key] = $val;\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\n\t\t\t\t\t//\t----------------------------------------\n\t\t\t\t\t//\tRedeclare\n\t\t\t\t\t//\t----------------------------------------\n\t\t\t\t\t//\tWe will reassign the $channel->query->result with our\n\t\t\t\t\t//\treordered array of values. Thank you PHP for being so fast with array loops.\n\t\t\t\t\t//\t----------------------------------------\n\n\t\t\t\t\t$super_temp_fake = $channel->query->result_array = $channel->query->result;\n\n\t\t\t\t\t$channel->fetch_categories();\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Handle {title} and {event_title} differently\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tee()->TMPL->tagdata\t= str_replace(\n\t\t\t\t\t\tLD . 'title' . RD,\n\t\t\t\t\t\t'6c21bdf1bfdab13bc8df8fcfeb2763a6' . LD . 'entry_id' . RD,\n\t\t\t\t\t\tee()->TMPL->tagdata\n\t\t\t\t\t);\n\n\t\t\t\t\tee()->TMPL->tagdata\t= str_replace(\n\t\t\t\t\t\tLD . 'event_title' . RD,\n\t\t\t\t\t\t'6c21bdf1bfdab13bc8df8fcfeb2763a6' . LD . 'entry_id' . RD,\n\t\t\t\t\t\tee()->TMPL->tagdata\n\t\t\t\t\t);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Remove \"ignore\" prefixes\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tee()->TMPL->tagdata = str_replace(\n\t\t\t\t\t\t'calendar_ignore_',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\tee()->TMPL->tagdata\n\t\t\t\t\t);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Parse Weblog stuff\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Parsing Weblog stuff');\n\n\t\t\t\t\t$channel->parse_channel_entries();\n\n\t\t\t\t\tforeach ($super_temp_fake as $k => $data)\n\t\t\t\t\t{\n\t\t\t\t\t\t$channel->return_data = str_replace(\n\t\t\t\t\t\t\t'6c21bdf1bfdab13bc8df8fcfeb2763a6' . $data['entry_id'],\n\t\t\t\t\t\t\t$super_temp_fake[$k]['title'],\n\t\t\t\t\t\t\t$channel->return_data\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Related entries\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Parsing related entries');\n\n\t\t\t\t\tif (version_compare($this->ee_version, '2.6.0', '<'))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (count(ee()->TMPL->related_data) > 0 AND\n\t\t\t\t\t\t\tcount($channel->related_entries) > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$channel->parse_related_entries();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (count(ee()->TMPL->reverse_related_data) > 0 AND\n\t\t\t\t\t\t\tcount($channel->reverse_related_entries) > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$channel->parse_reverse_related_entries();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Collect the parsed data for use later\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tpreg_match_all('/' . $blargle . '\\[(\\d+)\\](.*?)' . $bleegle . '/s', $channel->return_data, $matches);\n\t\t\t\t\tforeach ($matches[0] as $k => $match)\n\t\t\t\t\t{\n\t\t\t\t\t\t$entry_data[$matches[1][$k]] = $matches[2][$k];\n\t\t\t\t\t}\n\n\t\t\t\t\tunset($channel);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Stop the insanity!\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//ee()->TMPL->log_item('Calendar:build_calendar() Channel module stuff done');\n\n\t\t// -------------------------------------\n\t\t// Build the calendar\n\t\t// -------------------------------------\n\n\t\t//ee()->TMPL->log_item('Calendar: Starting to build the calendar');\n\n\t\t$start_year\t\t= $start['year'];\n\t\t$start_month\t= $start['month'];\n\t\t$start_day\t\t= $start['day'];\n\t\t$end_year\t\t= $end['year'];\n\t\t$end_month\t\t= $end['month'];\n\t\t$end_day\t\t= $end['day'];\n\t\t$w\t\t\t\t= 0;\n\n\t\t$this->CDT->reset();\n\n\t\tif ($this->P->value('pad_short_weeks') === TRUE)\n\t\t{\n\t\t\t$week_counter = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$week_counter = ($this->CDT->day_of_week >= $this->first_day_of_week) ?\n\t\t\t\t\t\t\t\t$this->CDT->day_of_week - $this->first_day_of_week :\n\t\t\t\t\t\t\t\t7 + $this->CDT->day_of_week - $this->first_day_of_week;\n\t\t}\n\n\t\t$output = '';\n\t\t$week_temp = $month_temp = $year_temp = '';\n\t\t$day_count = 0;\n\n\t\t$next_CDT = $prev_CDT = $start;\n\n\t\t$all_day = array();\n\t\t$event_array = array();\n\n\t\t// -------------------------------------\n\t\t// Prepare the events\n\t\t// -------------------------------------\n\n\t\t//ee()->TMPL->log_item('Calendar: Preparing events');\n\n\t\tforeach ($events as $id => $event)\n\t\t{\n\t\t\t//prevent missing entry data from attempting to display and causing errors\n\t\t\tif ( ! isset($entry_data[$event->default_data['entry_id']]))\n\t\t\t{\n\t\t\t\tunset($events[$id]);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (empty($event->dates))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tforeach ($event->dates as $ymd => $items)\n\t\t\t{\n\t\t\t\tforeach ($items as $time => $ddata)\n\t\t\t\t{\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// It was over before it started\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($ddata['end_date']['ymd'].$ddata['end_date']['time'] <\n\t\t\t\t\t\t$this->P->value('date_range_start', 'ymd') .\n\t\t\t\t\t\t$this->P->value('date_range_start', 'time'))\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\t// -------------------------------------\n\t\t\t\t\t// ...or the inverse\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($ddata['date']['ymd'].$ddata['date']['time'] >\n\t\t\t\t\t\t $this->P->value('date_range_end', 'ymd') .\n\t\t\t\t\t\t $this->P->value('time_range_end', 'time'))\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\t// -------------------------------------\n\t\t\t\t\t// If the start date of the event is less than the first\n\t\t\t\t\t// day of the calendar, we've got ourselves a hangover.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($ddata['date']['ymd'] < $this->P->value('date_range_start', 'ymd'))\n\t\t\t\t\t{\n\t\t\t\t\t\t$event_array[$this->P->value('date_range_start', 'ymd')]['all_day'][$id]\t= $id;\n\t\t\t\t\t\t$events[$id]->dates[$this->P->value('date_range_start', 'ymd')]\t\t\t\t= $events[$id]->dates[$ymd];\n\t\t\t\t\t}\n\t\t\t\t\telseif ($ddata['all_day'] === TRUE)\n\t\t\t\t\t{\n\t\t\t\t\t\t$event_array[$ymd]['all_day'][$id] = $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\tif ($ddata['multi_day'])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$event_array[$ymd]['all_day'][$id] = $id;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$start_hour\t= str_pad($ddata['date']['hour'], 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t$start_min\t= str_pad($ddata['date']['minute'], 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t$end_hour\t= str_pad($ddata['end_date']['hour'], 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t$end_min\t= str_pad($ddata['end_date']['minute'], 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t$event_array[$ymd][$start_hour][$start_min][$end_hour][$end_min][$id] = $id;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\n\t\t\t// -------------------------------------\n\t\t\t// Aliases\n\t\t\t// -------------------------------------\n\n\t\t\t$events[$id]->default_data['first_date']\t= $events[$id]->default_data['start_date'];\n\t\t}\n\n\t\t$this->CDT->reset();\n\n\t\t// -------------------------------------\n\t\t// Prune the event array, if there's an event limit.\n\t\t// NOTE: apply_event_limit() also sorts the array for us.\n\t\t// -------------------------------------\n\n\t\t//--------------------------------------------\n\t\t//\tcount all events for tag and pagination\n\t\t//--------------------------------------------\n\n\t\t$this->event_timeframe_total = $this->count_event_results($event_array);\n\n\t\t//--------------------------------------------\n\t\t//\tpagination\n\t\t//--------------------------------------------\n\n\t\t$this->paginate = FALSE;\n\n\t\tif ($this->P->value('event_limit') > 0 AND\n\t\t\t$this->event_timeframe_total > $this->P->value('event_limit'))\n\t\t{\n\t\t\t//get pagination info\n\t\t\t$pagination_data = $this->universal_pagination(array(\n\t\t\t\t'total_results'\t\t\t=> $this->event_timeframe_total,\n\t\t\t\t//had to remove this jazz before so it didn't get iterated over\n\t\t\t\t'tagdata'\t\t\t\t=> $tagdata . $this->paginate_tagpair_data,\n\t\t\t\t'limit'\t\t\t\t\t=> $this->P->value('event_limit'),\n\t\t\t\t'uri_string'\t\t\t=> ee()->uri->uri_string,\n\t\t\t\t'paginate_prefix'\t\t=> 'calendar_'\n\t\t\t));\n\n\t\t\t// -------------------------------------------\n\t\t\t// 'calendar_events_create_pagination' hook.\n\t\t\t// - Let devs maniuplate the pagination display\n\n\t\t\tif (ee()->extensions->active_hook('calendar_build_calendar_create_pagination') === TRUE)\n\t\t\t{\n\t\t\t\t$pagination_data = ee()->extensions->call(\n\t\t\t\t\t'calendar_build_calendar_create_pagination',\n\t\t\t\t\t$this,\n\t\t\t\t\t$pagination_data\n\t\t\t\t);\n\t\t\t}\n\t\t\t//\n\t\t\t// -------------------------------------------\n\n\t\t\t//if we paginated, sort the data\n\t\t\tif ($pagination_data['paginate'] === TRUE)\n\t\t\t{\n\t\t\t\t$this->paginate\t\t\t= $pagination_data['paginate'];\n\t\t\t\t$this->page_next\t\t= $pagination_data['page_next'];\n\t\t\t\t$this->page_previous\t= $pagination_data['page_previous'];\n\t\t\t\t$this->p_page\t\t\t= $pagination_data['pagination_page'];\n\t\t\t\t$this->current_page \t= $pagination_data['current_page'];\n\t\t\t\t$this->pager \t\t\t= $pagination_data['pagination_links'];\n\t\t\t\t$this->basepath\t\t\t= $pagination_data['base_url'];\n\t\t\t\t$this->total_pages\t\t= $pagination_data['total_pages'];\n\t\t\t\t$this->paginate_data\t= $pagination_data['paginate_tagpair_data'];\n\t\t\t\t$this->page_count\t\t= $pagination_data['page_count'];\n\t\t\t\t//$tagdata\t\t\t\t= $pagination_data['tagdata'];\n\t\t\t}\n\t\t}\n\n\t\t//--------------------------------------------\n\t\t//\tevent limiter\n\t\t//--------------------------------------------\n\n\t\t$offset = (\n\t\t\tee()->TMPL->fetch_param('event_offset') ?\n\t\t\t\tee()->TMPL->fetch_param('event_offset') :\n\t\t\t\t0\n\t\t);\n\n\t\t$page \t= (($this->current_page -1) * $this->P->value('event_limit'));\n\n\t\tif ($page > 0)\n\t\t{\n\t\t\t$offset += $page;\n\t\t}\n\n\t\t$event_array = $this->apply_event_limit(\n\t\t\t$event_array,\n\t\t\t$this->P->value('event_limit'),\n\t\t\t$offset\n\t\t);\n\n\t\t// -------------------------------------\n\t\t// Loopage\n\t\t// -------------------------------------\n\n\t\t//ee()->TMPL->log_item('Calendar: Beginning date loops');\n\n\t\t$week_event_count\t= 0;\n\t\t$event_count\t\t= 0;\n\t\t$year_tick\t\t\t= 0;\n\t\t$month_tick\t\t\t= 0;\n\n\t\tfor ($y = $start_year; $y <= $end_year; $y++)\n\t\t{\n\t\t\t$year_event_count = 0;\n\n\t\t\t//blank out\n\t\t\t$this->counted['year'] = array();\n\n\t\t\t$mx = ($y == $start_year) ? $start_month : 1;\n\t\t\t$my = ($y == $end_year) ? $end_month : 12;\n\n\t\t\t$year_ymd_cache = $this->CDT->ymd;\n\n\n\t\t\tfor ($m = $mx; $m <= $my; $m++)\n\t\t\t{\n\t\t\t\t$month_ymd_cache \t= $this->CDT->ymd;\n\n\n\t\t\t\t$month_event_count = 0;\n\n\t\t\t\t//blank out\n\t\t\t\t$this->counted['month'] = array();\n\n\t\t\t\t$dx = ($y == $start_year AND $m == $start_month) ?\n\t\t\t\t\t\t$start_day :\n\t\t\t\t\t\t1;\n\n\t\t\t\t$dy = ($y == $end_year AND $m == $end_month) ?\n\t\t\t\t\t\t$end_day :\n\t\t\t\t\t\t$this->CDT->days_in_month($m, $y);\n\n\t\t\t\tfor ($d = $dx; $d <= $dy; $d++)\n\t\t\t\t{\n\t\t\t\t\t$day_ymd_cache \t= $this->CDT->ymd;\n\t\t\t\t\t$day_tick\t\t= 0;\n\n\t\t\t\t\t$this->CDT->change_date($y, $m, $d);\n\t\t\t\t\t$this->CDT->set_default($this->CDT->date_array());\n\n\t\t\t\t\t$ymd = $this->CDT->ymd;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Prepare counts and totals, also\n\t\t\t\t\t// altered later in the loop in some cases\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$day_event_count = 0;\n\t\t\t\t\t$day_event_total = 0;\n\n\t\t\t\t\t//blank out\n\t\t\t\t\t$this->counted['day'] = array();\n\n\t\t\t\t\tif (! isset($event_array[$ymd])) $event_array[$ymd] = array();\n\n\t\t\t\t\t$day_event_total\t= $this->count_events(\n\t\t\t\t\t\t$ymd,\n\t\t\t\t\t\t$event_array,\n\t\t\t\t\t\t$all_day,\n\t\t\t\t\t\t'day',\n\t\t\t\t\t\t$events\n\t\t\t\t\t);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Start events for the day\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Beginning ' . $ymd . count( $event_array[$ymd] ) . ' events for this day.');\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// This looks a little goofy, but it\n\t\t\t\t\t// prevents extra years/months\n\t\t\t\t\t// showing up thanks to padded weeks\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$day_count++;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Week stuff\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($week_counter % 7 == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t//blank out\n\t\t\t\t\t\t$this->counted['week'] = array();\n\n\t\t\t\t\t\t$w = str_pad($this->CDT->week_number, 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t}\n\n\t\t\t\t\t$week_counter++;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// \"next\" stuff\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$next_y = ($m == 12 AND $d == 31) ? $y+1 : $y;\n\t\t\t\t\t$next_m = ($d == $this->CDT->days_in_month()) ? $m + 1 : $m;\n\t\t\t\t\t$next_w = ($week_counter % 7 == 0) ? $w + 1 : $w;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Yodelers of Mass Destruction\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$find\t\t\t= '';\n\t\t\t\t\t$replace\t\t= '';\n\t\t\t\t\t$hour_events\t= array();\n\t\t\t\t\t$last_day\t\t= (\n\t\t\t\t\t\t$y == $end_year AND\n\t\t\t\t\t\t$m == $end_month AND\n\t\t\t\t\t\t$d == $end_day\n\t\t\t\t\t) ? TRUE : FALSE;\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Remove \"all day\" stragglers\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tforeach ($all_day as $i => $stuff)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($ymd > $stuff['end_ymd'])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($all_day[$i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each event\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// \t$each_event contains the formatting\n\t\t\t\t\t// \tto use for displaying the contents\n\t\t\t\t\t// \tof an event on a given day in the calendar.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($each_event != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$event_output = '';\n\n\t\t\t\t\t\tif ( ! empty($event_array[$ymd]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tforeach ($event_array[$ymd] as $start_hour => $sh_data)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$hour_event_count\t= 0;\n\t\t\t\t\t\t\t\t$hour_event_total\t= count($sh_data);\n\n\t\t\t\t\t\t\t\tif ($start_hour == 'all_day')\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$prev_index = 0;\n\t\t\t\t\t\t\t\t\t$index = 0;\n\n\t\t\t\t\t\t\t\t\tforeach ($sh_data as $i => $id)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t\t\t\t// Multi-day events get one time key, regular\n\t\t\t\t\t\t\t\t\t\t// all day events get another\n\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t\t\t\t$time_key = '00002400';\n\n\t\t\t\t\t\t\t\t\t\tif ( ! isset( $events[$id]->dates[$ymd][$time_key]))\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t//so in some rare situations this\n\t\t\t\t\t\t\t\t\t\t\t//can come to us without being reset?\n\t\t\t\t\t\t\t\t\t\t\t//I hate moving pointers :p\n\t\t\t\t\t\t\t\t\t\t\treset($events[$id]->dates[$ymd]);\n\n\t\t\t\t\t\t\t\t\t\t\t$time_key = key($events[$id]->dates[$ymd]);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t$event_count++;\n\t\t\t\t\t\t\t\t\t\t$year_event_count++;\n\t\t\t\t\t\t\t\t\t\t$month_event_count++;\n\t\t\t\t\t\t\t\t\t\t$week_event_count++;\n\t\t\t\t\t\t\t\t\t\t$day_event_count++;\n\t\t\t\t\t\t\t\t\t\t$hour_event_count++;\n\n\t\t\t\t\t\t\t\t\t\t$vars = $this->get_occurrence_vars($id, $events[$id], $ymd, $time_key);\n\n\t\t\t\t\t\t\t\t\t\t$vars['conditional']['event_all_day']\t= TRUE;\n\n\t\t\t\t\t\t\t\t\t\t$vars['single']\t+= array(\n\t\t\t\t\t\t\t\t\t\t\t'event_count'\t\t\t\t=> $this->create_count_hash('event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'year_event_count'\t\t\t=> $this->create_count_hash('year_event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'month_event_count'\t\t\t=> $this->create_count_hash('month_event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'week_event_count'\t\t\t=> $this->create_count_hash('week_event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'day_event_count'\t\t\t=> $this->create_count_hash('day_event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'hour_event_count'\t\t\t=> $this->create_count_hash('hour_event_count'),\n\t\t\t\t\t\t\t\t\t\t\t'all_day_event_index_difference' => $index - $prev_index,\n\t\t\t\t\t\t\t\t\t\t\t'all_day_event_index'\t\t=> $index++,\n\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_minutes'\t=> (isset($events[$id]->dates[$ymd][$time_key])) ?\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->dates[$ymd][$time_key]['duration']['minutes'] :\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->default_data['duration']['minutes'],\n\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_hours'\t\t=> (isset($events[$id]->dates[$ymd][$time_key])) ?\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->dates[$ymd][$time_key]['duration']['hours'] :\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->default_data['duration']['hours'],\n\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_days'\t\t=> (isset($events[$id]->dates[$ymd][$time_key])) ?\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->dates[$ymd][$time_key]['duration']['days'] :\n\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id]->default_data['duration']['days']\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t//we have to remove conditionals for these items as well\n\t\t\t\t\t\t\t\t\t\t//because the dummy hashes screw with them\n\t\t\t\t\t\t\t\t\t\t$output_data = $this->remove_post_parse_conditionals(array(\n\t\t\t\t\t\t\t\t\t\t\t'event_count'\t=> $vars['single']['event_count'],\n\t\t\t\t\t\t\t\t\t\t\t'year_event_count'\t\t=> $vars['single']['year_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t'month_event_count' \t=> $vars['single']['month_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t'week_event_count'\t\t=> $vars['single']['week_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t'day_event_count'\t\t=> $vars['single']['day_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t'hour_event_count'\t\t=> $vars['single']['hour_event_count']\n\t\t\t\t\t\t\t\t\t\t), $entry_data[$id]);\n\n\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t\t\t\t// If we're outputting at the event level, then we have\n\t\t\t\t\t\t\t\t\t\t// to spit out the all day stuff here.\n\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t\t\t\tif ($output_at == 'event')\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$event_output .= $this->swap_vars($vars, $output_data);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t//shortcut\n\t\t\t\t\t\t\t\t\t\t$evtk =& $events[$id]->dates[$ymd][$time_key];\n\n\t\t\t\t\t\t\t\t\t\t$array = array(\n\t\t\t\t\t\t\t\t\t\t\t'output'\t\t\t\t\t=> $output_data,\n\t\t\t\t\t\t\t\t\t\t\t'vars'\t\t\t\t\t\t=> $vars,\n\t\t\t\t\t\t\t\t\t\t\t'first_day'\t\t\t\t\t=> $evtk['date']['ymd'],\n\t\t\t\t\t\t\t\t\t\t\t'last_day'\t\t\t\t\t=> $evtk['end_date']['ymd'],\n\t\t\t\t\t\t\t\t\t\t\t'start_ymd'\t\t\t\t\t=> $evtk['date']['ymd'],\n\t\t\t\t\t\t\t\t\t\t\t'end_ymd'\t\t\t\t\t=> $evtk['end_date']['ymd'],\n\t\t\t\t\t\t\t\t\t\t\t'time'\t\t\t\t\t\t=> $time_key,\n\t\t\t\t\t\t\t\t\t\t\t'id'\t\t\t\t\t\t=> $id,\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_minutes'\t=> $evtk['duration']['minutes'],\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_hours'\t\t=> $evtk['duration']['hours'],\n\t\t\t\t\t\t\t\t\t\t\t'event_duration_days'\t\t=> $evtk['duration']['days']\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t//unset($event_array[$ymd]['all_day'][$id]);\n\n\t\t\t\t\t\t\t\t\t\t$count\t\t= (empty($all_day)) ? 0 : max(array_keys($all_day));\n\t\t\t\t\t\t\t\t\t\t$inserted\t= FALSE;\n\t\t\t\t\t\t\t\t\t\t$prev_index\t= $index + 1;\n\n\t\t\t\t\t\t\t\t\t\tif (! in_array($array, $all_day))\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfor ($i = 0; $i <= $count; $i++)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t\t// Find a spot for this event\n\t\t\t\t\t\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t\t\t\t\t\tif (! isset($all_day[$i]))\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t$all_day[$i] = $array;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$inserted = TRUE;\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tif ($inserted === FALSE)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t$all_day[$i] = $array;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tksort($all_day);\n\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif ($each_hour != '')\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$hour_events[$start_hour] = $sh_data;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tforeach ($sh_data as $start_minute => $sm_data)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tforeach ($sm_data as $end_hour => $eh_data)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tforeach ($eh_data as $end_minute => $event_ids)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tforeach ($event_ids as $id)\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (isset($entry_data[$id]))\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$start_hour\t= str_pad($start_hour, 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$start_min\t= str_pad($start_min, 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$end_hour\t= str_pad($end_hour, 2, 0, STR_PAD_LEFT);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$end_min\t= str_pad($end_min, 2, 0, STR_PAD_LEFT);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$time_key = $start_hour.$start_minute.$end_hour.$end_minute;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ( ! isset($events[$id]->dates[$ymd][$time_key]))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$year_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$month_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$week_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$day_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$hour_event_count++;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars = $this->get_occurrence_vars(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$ymd,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$start_hour . $start_minute . $end_hour . $end_minute\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['event_duration_minutes']\t= $events[$id]->dates[$ymd][$time_key]['duration']['minutes'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['event_duration_hours']\t\t= $events[$id]->dates[$ymd][$time_key]['duration']['hours'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['event_duration_days']\t\t= $events[$id]->dates[$ymd][$time_key]['duration']['days'];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['event_count']\t\t\t\t= $this->create_count_hash('event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['year_event_count']\t\t\t= $this->create_count_hash('year_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['month_event_count']\t\t= $this->create_count_hash('month_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['week_event_count']\t\t\t= $this->create_count_hash('week_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['day_event_count']\t\t\t= $this->create_count_hash('day_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['hour_event_count']\t\t\t= $this->create_count_hash('hour_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['day_event_total']\t\t\t= $day_event_total;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['hour_event_total']\t\t\t= $hour_event_total;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['all_day_event_index']\t\t= 0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['all_day_event_index_difference'] = 0;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t//we have to remove conditionals for these items as well\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t//because the dummy hashes screw with them\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$output_data = $this->remove_post_parse_conditionals(array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'event_count'\t\t\t=> $vars['single']['event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'year_event_count'\t\t=> $vars['single']['year_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'month_event_count'\t\t=> $vars['single']['month_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'week_event_count'\t\t=> $vars['single']['week_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'day_event_count'\t\t=> $vars['single']['day_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'hour_event_count'\t\t=> $vars['single']['hour_event_count']\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t), $entry_data[$id]);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$event_output .= $this->swap_vars($vars, $output_data);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//parse day event counts\n\t\t\t\t\t\t\t$event_output = $this->parse_count_hashes('hour_event_count', $event_output);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$find = $hash_event;\n\t\t\t\t\t\t$replace = $event_output;\n\n\t\t\t\t\t\tif ($output_at == 'event')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// If $each_event is empty, $all_day never gets filled. Let's fix that.\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($each_event == '' AND isset($event_array[$ymd]['all_day']))\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach ($event_array[$ymd]['all_day'] as $id)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$time_key\t\t\t= (! isset( $events[$id]->dates[$ymd]['00002400'])) ?\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey($events[$id]->dates[$ymd]) :\n\t\t\t\t\t\t\t\t\t\t\t\t\t'00002400';\n\n\t\t\t\t\t\t\t$data['end_ymd']\t= $events[$id]->dates[$ymd][$time_key]['end_date']['ymd'];\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// This stuff can be gibberish since it'll never show, but we\n\t\t\t\t\t\t\t// provide it because other parts of the code expect it to exist\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$data['time']\t\t= '';\n\t\t\t\t\t\t\t$data['vars']\t\t= array();\n\t\t\t\t\t\t\t$data['first_day']\t= FALSE;\n\t\t\t\t\t\t\t$data['last_day']\t= FALSE;\n\t\t\t\t\t\t\t$data['output']\t\t= '';\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Add the all day event\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$all_day[]\t\t\t= $data;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$all_day_event_total\t= count($all_day);\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// \"All day\" output\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t$all_day_output = '';\n\n\t\t\t\t\tif ( ! empty($all_day))\n\t\t\t\t\t{\n\t\t\t\t\t\t$prev_index = 0;\n\t\t\t\t\t\t$hour_event_count = 0;\n\n\t\t\t\t\t\tforeach ($all_day as $all_day_data)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$time_key\t= $all_day_data['time'];\n\t\t\t\t\t\t\t$vars\t\t= $all_day_data['vars'];\n\t\t\t\t\t\t\t$vars['single']['event_first_day']\t= ($ymd == $all_day_data['first_day']) ? TRUE : FALSE;\n\t\t\t\t\t\t\t$vars['single']['event_last_day']\t= ($ymd == $all_day_data['last_day']) ? TRUE : FALSE;\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Process all day variables\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$all_day_output\t.= $this->swap_vars($vars, $all_day_data['output']);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each hour\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($each_hour != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$hour_output = '';\n\t\t\t\t\t\t$hour_temp = '';\n\n\t\t\t\t\t\tif ($all_day_output != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$hour_output = $all_day_output;\n\t\t\t\t\t\t\t$all_day_output = '';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ($i = 0; $i < 24; $i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$hour_temp\t\t\t= '';\n\t\t\t\t\t\t\t$hour_count\t\t\t= 0;\n\t\t\t\t\t\t\t$hour_event_count\t= 0;\n\t\t\t\t\t\t\t$h\t\t\t\t\t= str_pad($i, 2, '0', STR_PAD_LEFT);\n\t\t\t\t\t\t\t//$this->cdt_format_date_string($this->CDT->datetime_array(), 'H');\n\t\t\t\t\t\t\t$minute\t\t\t\t= '00';\n\t\t\t\t\t\t\t//$this->cdt_format_date_string($this->CDT->datetime_array(), 'i');\n\n\t\t\t\t\t\t\tif (isset($hour_events[$h]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tforeach ($hour_events[$h] as $start_minute => $sm_data)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tforeach ($sm_data as $end_hour => $eh_data)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tforeach ($eh_data as $end_minute => $event_ids)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$hour_count += count($event_ids);\n\n\t\t\t\t\t\t\t\t\t\t\tforeach ($event_ids as $id)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (isset($entry_data[$id]))\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t$event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$year_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$month_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$week_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$day_event_count++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t$hour_event_count++;\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars = $this->get_occurrence_vars(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$events[$id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$ymd,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$h . $start_minute . $end_hour . $end_minute\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['event_count']\t\t\t= $this->create_count_hash('event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['hour_event_count']\t\t= $this->create_count_hash('hour_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['year_event_count']\t\t= $this->create_count_hash('year_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['month_event_count']\t= $this->create_count_hash('month_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['week_event_count']\t\t= $this->create_count_hash('week_event_count');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$vars['single']['day_event_count']\t\t= $this->create_count_hash('day_event_count');\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t//we have to remove conditionals for these items as well\n\t\t\t\t\t\t\t\t\t\t\t\t\t//because the dummy hashes screw with them\n\t\t\t\t\t\t\t\t\t\t\t\t\t$output_data = $this->remove_post_parse_conditionals(array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'event_count'\t\t\t=> $vars['single']['event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'year_event_count'\t\t=> $vars['single']['year_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'month_event_count'\t\t=> $vars['single']['month_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'week_event_count'\t\t=> $vars['single']['week_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'day_event_count'\t\t=> $vars['single']['day_event_count'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'hour_event_count'\t\t=> $vars['single']['hour_event_count']\n\t\t\t\t\t\t\t\t\t\t\t\t\t), $entry_data[$id]);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t$hour_temp .= $this->swap_vars($vars, $output_data);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$hour_temp = str_replace($find, $hour_temp, $each_hour);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$hour_temp = str_replace($find, $replace, $each_hour);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$vars = array();\n\t\t\t\t\t\t\t$total_events = $hour_count;\n\t\t\t\t\t\t\t$this->CDT->change_time($i, 0);\n\n\t\t\t\t\t\t\t$vars['date'] = array(\n\t\t\t\t\t\t\t\t'time'\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'date'\t\t=> $this->CDT->datetime_array()\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t\t\t'hour'\t\t\t\t=> $h,\n\t\t\t\t\t\t\t\t'minute'\t\t\t=> $minute,\n\t\t\t\t\t\t\t\t'time'\t\t\t\t=> $h.':'.$minute,\n\t\t\t\t\t\t\t\t'hour_event_total' \t=> $total_events\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$hour_output .= $this->swap_vars($vars, $hour_temp);\n\n\t\t\t\t\t\t\t//parse day event counts\n\t\t\t\t\t\t\t$hour_output = $this->parse_count_hashes('hour_event_count', $hour_output);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$find = $hash_hour;\n\t\t\t\t\t\t$replace = $hour_output;\n\n\t\t\t\t\t\tif ($output_at == 'hour')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n\n\t\t\t\t\t\t\t//ee()->TMPL->log_item('Calendar: Outputting hour data for '.$ymd);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each day\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t//var_dump($this->CDT->ymd . ' OUTSIDE DAY');\n\n\t\t\t\t\tif ($each_day != '')\n\t\t\t\t\t{\n\t\t\t\t\t\t$prefix = $suffix = '';\n\n\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t// Prep day variables\n\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\tif ($all_day_output != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replace = $all_day_output . $replace;\n\t\t\t\t\t\t\t$all_day_output = '';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' DAY');\n\n\t\t\t\t\t\t$day_output = str_replace($find, $replace, $each_day);\n\n\t\t\t\t\t\t$next_CDT = $this->CDT->add_day(1);\n\t\t\t\t\t\t$prev_CDT = $this->CDT->add_day(-2);\n\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' DAY 2');\n\n\t\t\t\t\t\t$vars = array();\n\n\t\t\t\t\t\t$vars['conditional'] = array(\n\t\t\t\t\t\t\t'day_is_today'\t\t\t=> ($today_ymd == $ymd) ? TRUE : FALSE,\n\t\t\t\t\t\t\t'day_is_weekend'\t\t=> ($this->CDT->day_of_week == 0 OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->CDT->day_of_week == 6) ? TRUE : FALSE,\n\t\t\t\t\t\t\t'day_is_weekday'\t\t=> ($this->CDT->day_of_week == 0 OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->CDT->day_of_week == 6) ? FALSE : TRUE,\n\t\t\t\t\t\t\t'day_in_current_month'\t=> ($this->CDT->month == $current_period_start['month']) ? TRUE : FALSE,\n\t\t\t\t\t\t\t'day_in_previous_month'\t=> ($this->CDT->month < $current_period_start['month'] OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->CDT->year < $current_period_start['year']) ? TRUE : FALSE,\n\t\t\t\t\t\t\t'day_in_next_month'\t\t=> ($this->CDT->month > $current_period_start['month'] OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->CDT->year > $current_period_start['year']) ? TRUE : FALSE\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t\t'day'\t\t\t\t\t=> $d,\n\t\t\t\t\t\t\t'prev_day'\t\t\t\t=> $prev_CDT['day'],\n\t\t\t\t\t\t\t'next_day'\t\t\t\t=> $next_CDT['day'],\n\t\t\t\t\t\t\t'day_event_total'\t\t=> $day_event_total,\n\t\t\t\t\t\t\t'all_day_event_total'\t=> $all_day_event_total\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$vars['date'] = array(\n\t\t\t\t\t\t\t'day' \t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t'date'\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t'prev_day' \t=> $prev_CDT,\n\t\t\t\t\t\t\t'next_day'\t=> $next_CDT\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$day_output = $this->parse_count_hashes('day_event_count', $this->swap_vars($vars, $day_output));\n\n\n\t\t\t\t\t\t$find = $hash_day;\n\t\t\t\t\t\t$replace = $prefix.$day_output.$suffix;\n\n\t\t\t\t\t\tif ($output_at == 'day')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n//ee()->TMPL->log_item('Calendar: Outputting day data for '.$ymd);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' DAY 3');\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each week\n\t\t\t\t\t// -------------------------------------\n\n//var_dump($this->CDT->ymd . ' OUTSIDE WEEK');\n\n\t\t\t\t\tif ($each_week != '')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($all_day_output != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replace = $all_day_output . $replace;\n\t\t\t\t\t\t\t$all_day_output = '';\n\t\t\t\t\t\t\tif ($each_day == '')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$all_day = array();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ($w != $next_w OR\n\t\t\t\t\t\t\t($each_month != '' AND\n\t\t\t\t\t\t\t\t(($m != $next_m OR $last_day === TRUE) AND\n\t\t\t\t\t\t\t\t\t($ymd >= $current_period_start['ymd'] AND\n\t\t\t\t\t\t\t\t\t\t(\t($last_day === TRUE AND $ymd == $current_period_end['ymd']) OR\n\t\t\t\t\t\t\t\t\t\t($ymd != $current_period_end['ymd']))))) OR\n\t\t\t\t\t\t\t$last_day === TRUE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' WEEK');\n\n\t\t\t\t\t\t\t$week_temp .= $replace;\n\t\t\t\t\t\t\t$week_output = str_replace($find, $week_temp, $each_week);\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Prep week variables\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$offset = ($this->CDT->day_of_week > $this->first_day_of_week) ?\n\t\t\t\t\t\t\t\t\t\t$this->CDT->day_of_week - $this->first_day_of_week :\n\t\t\t\t\t\t\t\t\t\t7 - ($this->first_day_of_week - $this->CDT->day_of_week);\n\n\t\t\t\t\t\t\t$this->CDT->add_day(-$offset);\n\t\t\t\t\t\t\t$this->CDT->set_default($this->CDT->datetime_array());\n\t\t\t\t\t\t\t$next_CDT = $this->CDT->add_day(7);\n\t\t\t\t\t\t\t$prev_CDT = $this->CDT->add_day(-14);\n\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' WEEK 2');\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Calculate the number of events this week\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$week_event_total \t= 0;\n\n\t\t\t\t\t\t\t//$week_count_id\t\t= 'week_event_total_' . uniqid();\n\n\t\t\t\t\t\t\tif (strpos($each_week, 'week_event_total') !== FALSE)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$low\t= $this->CDT->year .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->month, 2, '0', STR_PAD_LEFT) .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->day, 2, '0', STR_PAD_LEFT);\n\n\t\t\t\t\t\t\t\t$this->CDT->add_day(6);\n\n\t\t\t\t\t\t\t\t$high\t= $this->CDT->year .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->month, 2, '0', STR_PAD_LEFT) .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->day, 2, '0', STR_PAD_LEFT);\n\n\t\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t\tforeach ($event_array as $k => $v)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ($k < $low OR $k > $high)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t$week_event_total += $this->count_events($k, $event_array, $all_day, 'week', $events);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$vars = array();\n\n\t\t\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t\t\t'week'\t\t\t\t=> $w,\n\t\t\t\t\t\t\t\t'prev_week'\t\t\t=> $prev_CDT['week_number'],\n\t\t\t\t\t\t\t\t'next_week'\t\t\t=> $next_CDT['week_number'],\n\t\t\t\t\t\t\t\t'week_event_total' \t=> $week_event_total\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$vars['date'] = array(\n\t\t\t\t\t\t\t\t'week' \t\t \t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'date' \t\t \t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'prev_week' \t\t=> $prev_CDT,\n\t\t\t\t\t\t\t\t'next_week'\t \t\t=> $next_CDT\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$week_output = $this->parse_count_hashes('week_event_count', $this->swap_vars($vars, $week_output));\n\n\t\t\t\t\t\t\t$find = $hash_week;\n\t\t\t\t\t\t\t$replace = $week_output;\n\t\t\t\t\t\t\t$week_temp = '';\n\n\t\t\t\t\t\t\tif ($output_at == 'week')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t\t$replace = '';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t\t\t$week_event_count = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($end['day'] == $d AND\n\t\t\t\t\t\t\t\t$end['month'] == $m AND\n\t\t\t\t\t\t\t\t$d == $this->CDT->days_in_month($m, $y) AND\n\t\t\t\t\t\t\t\t$this->P->value('pad_short_weeks') === TRUE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$week_temp .= $replace;\n\t\t\t\t\t\t\t$week_output = str_replace($find, $week_temp, $each_week);\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Prep week variables\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$this->CDT->add_day(-6);\n\t\t\t\t\t\t\t$next_CDT = $this->CDT->add_day(7);\n\t\t\t\t\t\t\t$prev_CDT = $this->CDT->add_day(-14);\n\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Calculate the number of events this week\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$week_event_total = 0;\n\n\t\t\t\t\t\t\tif (strpos($each_week, 'week_event_total') !== FALSE)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$low\t= $this->CDT->year .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->month, 2, '0', STR_PAD_LEFT) .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->day, 2, '0', STR_PAD_LEFT);\n\n\t\t\t\t\t\t\t\t$this->CDT->add_day(6);\n\n\t\t\t\t\t\t\t\t$high\t= $this->CDT->year .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->month, 2, '0', STR_PAD_LEFT) .\n\t\t\t\t\t\t\t\t\t\t\tstr_pad($this->CDT->day, 2, '0', STR_PAD_LEFT);\n\n\t\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t\tforeach ($event_array as $k => $v)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ($k < $low OR $k > $high)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t$week_event_total += $this->count_events($k, $event_array, $all_day, 'week', $events);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$vars = array();\n\n\t\t\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t\t\t'week'\t\t\t\t=> $w,\n\t\t\t\t\t\t\t\t'prev_week'\t\t\t=> $prev_CDT['week_number'],\n\t\t\t\t\t\t\t\t'next_week'\t\t\t=> $next_CDT['week_number'],\n\t\t\t\t\t\t\t\t'week_event_total' \t=> $week_event_total\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$vars['date'] = array(\n\t\t\t\t\t\t\t\t'week' \t\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'date'\t\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'prev_week' \t\t=> $prev_CDT,\n\t\t\t\t\t\t\t\t'next_week'\t\t\t=> $next_CDT\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$week_output = $this->parse_count_hashes('week_event_count', $this->swap_vars($vars, $week_output));\n\n\t\t\t\t\t\t\t$find \t\t= $hash_week;\n\t\t\t\t\t\t\t$replace \t= $week_output;\n\t\t\t\t\t\t\t$week_temp \t= '';\n\n\t\t\t\t\t\t\tif ($output_at == 'week')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t\t$replace = '';\n//ee()->TMPL->log_item('Calendar: Outputting week data for '.$ymd);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t\t\t$week_event_count = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$week_temp .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each month\n\t\t\t\t\t// -------------------------------------\n\n//var_dump($this->CDT->ymd . ' OUTSIDE MONTH');\n\n\t\t\t\t\tif ($each_month != '')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($all_day_output != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replace = $all_day_output . $replace;\n\t\t\t\t\t\t\t$all_day_output = '';\n\t\t\t\t\t\t\tif ($each_day == '')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$all_day = array();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (($m != $next_m OR $last_day === TRUE) AND\n\t\t\t\t\t\t\t(\t$ymd >= $current_period_start['ymd'] AND\n\t\t\t\t\t\t\t\t(\t($last_day === TRUE AND $ymd == $current_period_end['ymd']) OR\n\t\t\t\t\t\t\t\t\t($ymd != $current_period_end['ymd'])\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$month_temp .= $replace;\n\t\t\t\t\t\t\t$month_output = str_replace($find, $month_temp, $each_month);\n\n\t\t\t\t\t\t\t//--------------------------------------------\n\t\t\t\t\t\t\t//\treset and add month because\n\t\t\t\t\t\t\t//\tthis gets 'off' some places\n\t\t\t\t\t\t\t//--------------------------------------------\n\t\t\t\t\t\t\t$this->CDT->set_default($current_period_start);\n\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t//first month is correct\n\t\t\t\t\t\t\tif ($month_tick > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$this->CDT->add_month($month_tick);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$month_tick++;\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Prep month variables\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t//add a month\n\t\t\t\t\t\t\t$next_CDT = $this->CDT->add_month();\n\n\t\t\t\t\t\t\t//subtract 2\n\t\t\t\t\t\t\t$prev_CDT = $this->CDT->add_month(-2);\n\n\t\t\t\t\t\t\t//add 1, now we are back where we started!\n\t\t\t\t\t\t\t$this->CDT->add_month();\n\t\t\t\t\t\t\t$this->CDT->change_date($this->CDT->year, $this->CDT->month, 1);\n\n\t\t\t\t\t\t\t$vars = array();\n\n\t\t\t\t\t\t\t//var_dump($this->CDT->ymd . ' MONTH 2');\n\n\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t// Calculate the number of events this month\n\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t$month_event_total = 0;\n\n\t\t\t\t\t\t\tif (strpos($each_month, 'month_event_total') !== FALSE)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$low\t= $this->CDT->year.str_pad($this->CDT->month, 2, '0', STR_PAD_LEFT).'01';\n\t\t\t\t\t\t\t\t$high\t= $this->CDT->year.str_pad($this->CDT->month, 2, '0', STR_PAD_LEFT).$this->CDT->days_in_month();\n\n\t\t\t\t\t\t\t\tforeach ($event_array as $k => $v)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ($k < $low OR $k > $high)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t$month_event_total += $this->count_events($k, $event_array, $all_day, 'month', $events);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//$vars['conditional'] = array( 'day_in_current_month' => TRUE );\n\t\t\t\t\t\t\t$vars['single'] = array(\n\t\t\t\t\t\t\t\t'month'\t\t\t\t=> $m,\n\t\t\t\t\t\t\t\t'prev_month'\t\t=> $prev_CDT['month'],\n\t\t\t\t\t\t\t\t'next_month'\t\t=> $next_CDT['month'],\n\t\t\t\t\t\t\t\t'month_event_total' => $month_event_total\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$vars['date'] = array(\n\t\t\t\t\t\t\t\t'month' \t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'date'\t\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t'prev_month' \t\t=> $prev_CDT,\n\t\t\t\t\t\t\t\t'next_month'\t\t=> $next_CDT\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$month_output \t= $this->parse_count_hashes(\n\t\t\t\t\t\t\t\t'month_event_count',\n\t\t\t\t\t\t\t\t$this->swap_vars($vars, $month_output)\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t$replace \t\t= $month_output;\n\n\t\t\t\t\t\t\t$find = $hash_month;\n\t\t\t\t\t\t\t$month_temp = '';\n\n\t\t\t\t\t\t\tif ($output_at == 'month')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t\t$replace = '';\n//ee()->TMPL->log_item('Calendar: Outputting month data for '.$ymd);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$month_temp .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t// Each year\n\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\tif ($each_year != '')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($all_day_output != '')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replace = $all_day_output . $replace;\n\t\t\t\t\t\t\t$all_day_output = '';\n\t\t\t\t\t\t\tif ($each_day == '')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$all_day = array();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ($y != $next_y OR $last_day === TRUE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//if ($last_day !== TRUE)\n\t\t\t\t\t\t\tif ($last_day == TRUE)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$year_temp .= $replace;\n\n\t\t\t\t\t\t\t\t$year_output = str_replace($find, $year_temp, $each_year);\n\n\t\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t\t// Calculate the number of events this year\n\t\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t\t$year_event_total = 0;\n\n\t\t\t\t\t\t\t\tif (strpos(ee()->TMPL->tagdata, 'year_event_total') !== FALSE)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$low\t= $this->CDT->year.'0101';\n\t\t\t\t\t\t\t\t\t$high\t= $this->CDT->year.'1231';\n\t\t\t\t\t\t\t\t\tforeach ($event_array as $k => $v)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif ($k < $low OR $k > $high)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t$year_event_total += $this->count_events($k, $event_array, array(), 'year', $events);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// -------------------------------------\n\t\t\t\t\t\t\t\t// Prep year variables\n\t\t\t\t\t\t\t\t// -------------------------------------\n\n\t\t\t\t\t\t\t\t$this->CDT->set_default($current_period_start);\n\t\t\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t\t\t\tif ($year_tick > 1)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$this->CDT->add_year($year_tick);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$year_tick++;\n\n\t\t\t\t\t\t\t\t$next_CDT = $this->CDT->add_year(1);\n\t\t\t\t\t\t\t\t$prev_CDT = $this->CDT->add_year(-2);\n\t\t\t\t\t\t\t\t$this->CDT->reset();\n\n\t\t\t\t\t\t\t\t$vars = array();\n\n\t\t\t\t\t\t\t\t$vars['conditional']\t\t= array(\n\t\t\t\t\t\t\t\t\t'year_is_leap_year'\t=> $this->CDT->is_leap_year()\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$vars['single']\t\t\t\t= array(\n\t\t\t\t\t\t\t\t\t'year'\t\t\t\t=> $y,\n\t\t\t\t\t\t\t\t\t'prev_year'\t\t\t=> $prev_CDT['year'],\n\t\t\t\t\t\t\t\t\t'next_year'\t\t\t=> $next_CDT['year'],\n\t\t\t\t\t\t\t\t\t'year_event_total'\t=> $year_event_total\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$vars['date']\t\t\t\t= array(\n\t\t\t\t\t\t\t\t\t'year' \t\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t\t'date'\t\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t\t\t\t\t\t'prev_year' \t\t=> $prev_CDT,\n\t\t\t\t\t\t\t\t\t'next_year' \t\t=> $next_CDT\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$year_output = $this->parse_count_hashes(\n\t\t\t\t\t\t\t\t\t'year_event_count',\n\t\t\t\t\t\t\t\t\t$this->swap_vars($vars, $year_output)\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t$replace = $year_output;\n\n\t\t\t\t\t\t\t\t$this->CDT->reset();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t//$replace = '';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$find = $hash_year;\n\t\t\t\t\t\t\t$year_temp = '';\n\n\t\t\t\t\t\t\tif ($output_at == 'year')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$output .= $replace;\n\t\t\t\t\t\t\t\t$replace = '';\n//ee()->TMPL->log_item('Calendar: Outputting year data for '.$ymd);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$year_temp .= $replace;\n\t\t\t\t\t\t\t$replace = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//parse day event counts\n\t\t\t\t\t//$output = $this->parse_count_hashes('day_event_count', $output);\n\n\t\t\t\t\t//parse week event counts\n\t\t\t\t\t//$output = $this->parse_count_hashes('week_event_count', $output);\n\t\t\t\t}\n\n\t\t\t\t//parse month event counts\n\t\t\t\t//$output = $this->parse_count_hashes('month_event_count', $output);\n\t\t\t}\n\n\t\t\t//parse year event count\n\t\t\t//$output = $this->parse_count_hashes('year_event_count', $output);\n\t\t}\n\n\t\t// -------------------------------------\n\t\t//\trunning all of these again in case\n\t\t//\tthe didn't fire. This means we\n\t\t//\tare in a straight event loop in\n\t\t//\tcal and it's probably errorsome :/\n\t\t// -------------------------------------\n\n\t\t//parse hour event counts\n\t\t$output = $this->parse_count_hashes('hour_event_count', $output);\n\n\t\t//parse day event counts\n\t\t$output = $this->parse_count_hashes('day_event_count', $output);\n\n\t\t//parse week event counts\n\t\t$output = $this->parse_count_hashes('week_event_count', $output);\n\n\t\t//parse month event counts\n\t\t$output = $this->parse_count_hashes('month_event_count', $output);\n\n\t\t//parse year event count\n\t\t$output = $this->parse_count_hashes('year_event_count', $output);\n\n\t\t//parse year event count\n\t\t$output = $this->parse_count_hashes('event_count', $output);\n\n\t\t$output = $this->swap_vars(array('single'=>array('event_total' => $event_count)), $output);\n\n\t\t$hash = 'hash_'.$output_at;\n\n\t\t$tagdata = isset($$hash) ? str_replace($$hash, $output, $tagdata) : $output;\n\n\t\t$tagdata = $this->parse_pagination($tagdata);\n\n\t\t//ee()->TMPL->log_item('Calendar: All done!');\n\n\t\t// -------------------------------------\n\t\t//\tsetting everything back thats not parsed\n\t\t//\tin case people were writing it in plain text\n\t\t// -------------------------------------\n\n\t\t//custom variables with the letters 'url' are borked in\n\t\t//EE 2.6. Bug reported, but this should fix.\n\t\t//https://support.ellislab.com/bugs/detail/19337\n\t\tif (version_compare($this->ee_version, '2.6.0', '>='))\n\t\t{\n\t\t\t$tagdata = str_replace(\n\t\t\t\tarray(\n\t\t\t\t\tLD . 'event_borked_title' . RD,\n\t\t\t\t\t'\"event_borked_title\"',\n\t\t\t\t\t\"'event_borked_title'\"\n\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\tLD . 'event_url_title' . RD,\n\t\t\t\t\t'\"event_url_title\"',\n\t\t\t\t\t\"'event_url_title'\"\n\t\t\t\t),\n\t\t\t\t$tagdata\n\t\t\t);\n\n\n\t\t\t$tagdata = str_replace(\n\t\t\t\tarray(\n\t\t\t\t\tLD . 'event_calendar_borked_title' . RD,\n\t\t\t\t\t'\"event_calendar_borked_title\"',\n\t\t\t\t\t\"'event_calendar_borked_title'\"\n\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\tLD . 'event_calendar_url_title' . RD,\n\t\t\t\t\t'\"event_calendar_url_title\"',\n\t\t\t\t\t\"'event_calendar_url_title'\"\n\t\t\t\t),\n\t\t\t\t$tagdata\n\t\t\t);\n\t\t}\n\n\t\t//--------------------------------------------\n\t\t//\tthis shouldn't ever be needed, but here we are\n\t\t//--------------------------------------------\n\n\t\tif (trim($tagdata) === '')\n\t\t{\n\t\t\treturn $this->no_results();\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Send 'em home\n\t\t// -------------------------------------\n\n\t\treturn $tagdata;\n\t}", "public function getCalendar() {\n\t\t$this->setDate();\n\t\t$this->getLinks();\n\t\t $this->di->logger->stamp(__CLASS__, __METHOD__, '');\n\n\n\t\t// Get new date array\n\t\t$newDate = getdate(mktime(0,0,0,$this->newMonth, 1, $this->newYear));\n\t\t// Calculate rest days in previous and next month\n\t\t$firstDay = $newDate['wday'];\n\t\t$firstDay = ($firstDay == 0) ? 7: $firstDay;\n\t\t$daysInMonth = cal_days_in_month ( CAL_GREGORIAN , $this->newMonth , $this->newYear );\n\t\tif($this->newMonth != 1){\n\t\t\t$daysInPrevMonth = cal_days_in_month ( CAL_GREGORIAN , $this->newMonth-1 , $this->newYear );\n\t\t}\n\t\telse if($this->newMonth == 1) {\n\t\t\t$daysInPrevMonth = cal_days_in_month ( CAL_GREGORIAN , 12 , $this->newYear-1 );\n\t\t}\n\n\t\t$lastDates = $daysInPrevMonth - $firstDay +1;\n\n\t\t// Start building table\n\t\t$table =\"<section class='calendar'><header>\" . $this->prevLink . \"<h3>\" . $newDate['month'] . \" - \" . $newDate['year'] . \"</h3>\" . $this->nextLink;\n\t\t$table .= \"</header><table><thead>\\n\";\n\t\t$table .= \"<th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th>\\n\";\n\t\t$table .= \"</thead>\\n\";\n\t\t$table .= \"<tr>\";\n\t\t\n\t\tfor ($a=1; $a < $firstDay ; $a++) { \n\t\t\t$lastDates++;\n\t\t\t$table .= \"<td class='lighter'>\" . $lastDates . \"</td>\";\n\t\t}\n\n\t\t$d = 0;\n\t\tfor ($b=0; $b < $daysInMonth ; $b++) { \n\t\t\t\n\t\t\t$d++;\n\t\t\t$DATE = date('N',mktime(0,0,0, $this->newMonth, $d, $this->newYear));\n\t\t\t\n\t\t\tif ($DATE == 1) {\n\t\t\t\t$table .= \"</tr>\\n<tr>\";\n\t\t\t}\n\n\t\t\tif (($this->newMonth == $this->currentMonth && $d == $this->currentDate && $this->newYear == $this->currentYear)) {\n\t\t\t\t$table .= \"<td><strong>\" . $d . \"</strong></td>\";\n\t\t\t}\n\t\t\telse if ($DATE == 7) {\n\t\t\t\t$table .= \"<td class='red'>\" . $d . \"</td>\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$table .= \"<td>\" . $d . \"</td>\";\n\t\t\t}\n\t\t}\n\t\t\tif ($DATE != 7) {\n\t\t\t\t$nextMonthDays = 7 - $DATE;\n\t\t\t\tfor ($c=1; $c <= $nextMonthDays ; $c++) { \n\t\t\t\t\t$table .= \"<td class='lighter'>\" . $c . \"</td>\";\n\t\t\t}\n\t}\n\t\t$table .= \"</tr></table></section>\";\n\n\t\treturn $table;\n\t}", "public static function icalendar() {\r\n $ical = \"BEGIN:VCALENDAR\".PHP_EOL;\r\n $ical .= \"VERSION:2.0\".PHP_EOL;\r\n\r\n $show_personal_bak = Calendar_Events::$calsettings->show_personal;\r\n $show_course_bak = Calendar_Events::$calsettings->show_course;\r\n $show_deadline_bak = Calendar_Events::$calsettings->show_deadline;\r\n $show_admin_bak = Calendar_Events::$calsettings->show_admin;\r\n Calendar_Events::set_calendar_settings(1,1,1,1);\r\n Calendar_Events::get_calendar_settings();\r\n $eventlist = Calendar_Events::get_calendar_events();\r\n Calendar_Events::set_calendar_settings($show_personal_bak,$show_course_bak,$show_deadline_bak,$show_admin_bak);\r\n Calendar_Events::get_calendar_settings();\r\n\r\n $events = array();\r\n foreach ($eventlist as $event) {\r\n $ical .= \"BEGIN:VEVENT\".PHP_EOL;\r\n $startdatetime = new DateTime($event->start);\r\n $ical .= \"DTSTART:\".$startdatetime->format(\"Ymd\\THis\").PHP_EOL;\r\n $duration = new DateTime($event->duration);\r\n $ical .= \"DURATION:\".$duration->format(\"\\P\\TH\\Hi\\Ms\\S\").PHP_EOL;\r\n $ical .= \"SUMMARY:[\".strtoupper($event->event_group).\"] \".$event->title.PHP_EOL;\r\n $ical .= \"DESCRIPTION:\".canonicalize_whitespace(strip_tags($event->content)).PHP_EOL;\r\n if ($event->event_group == 'deadline')\r\n {\r\n $ical .= \"BEGIN:VALARM\".PHP_EOL;\r\n $ical .= \"TRIGGER:-PT24H\".PHP_EOL;\r\n $ical .= \"DURATION:PT10H\".PHP_EOL;\r\n $ical .= \"ACTION:DISPLAY\".PHP_EOL;\r\n $ical .= \"DESCRIPTION:DEADLINE REMINDER for \".canonicalize_whitespace(strip_tags($event->title)).PHP_EOL;\r\n $ical .= \"END:VALARM\".PHP_EOL;\r\n }\r\n $ical .= \"END:VEVENT\".PHP_EOL;\r\n }\r\n $ical .= \"END:VCALENDAR\".PHP_EOL;\r\n return $ical;\r\n }", "private function makeArrayIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\t\t\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'normalDay';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'weekendDay';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['style'] = 'currentDay';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t} \n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['dayname'] = $this->daysArray[$this->weekDayNum - 1];\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['weekdaynumber'] = $this->weekDayNum;\n\t\t\t\t\t\t\t\t\t\n\t\t\t// Draw days\n\t\t\tif($this->makeDayEventListArray()) {\n\t\t\t\t$this->outArray['days'][$this->dayOfMonth]['events'] = $this->makeDayEventListArray();\n\t\t\t}\n\t\t\t\n\t\t\t$this->outArray['days'][$this->dayOfMonth]['datestamp'] = $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth;\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "function output_calendar() // Generating calendar HTML content\r\n\t{\r\n\t\t# Apparently, it's not possible to dereference $this->callback()\r\n\t\t$cb = $this->callback;\r\n\r\n\t\t# Preliminary calculations\r\n\t\t$t = getdate(strtotime($this->date));\r\n\t\t$today = $t[\"mday\"];\r\n\t\t$year = $t[\"year\"];\r\n\t\t$month = $t[\"mon\"];\r\n\t\t# Get first day of the month (monday = 0)\r\n\t\t$first_wday = ((int) date(\"w\", mktime(0, 0, 0, $month, 1, $year))+6)%7;\r\n\t\t# Last day of the month\r\n\t\t$last_mday = (int) date(\"d\", mktime(0, 0, 0, $month+1, 0, $year));\r\n\r\n\t\t# Anchor\r\n\t\t//$this->content[].=\"<a name=\\\"calendar\\\">\";\r\n\r\n\t\t# Table\r\n\t\t$this->content[].=\"<table width=\\\"100%\\\" align=\\\"center\\\" cellpadding=\\\"0\\\" cellspacing=\\\"2\\\" class=\\\"calendar\\\">\\n\";\r\n\r\n\t\t# Table head\r\n\t\t$this->content[].=\"<tr><td colspan=\\\"7\\\" class=\\\"calendar_header\\\">{$this->month_name[$month - 1]}&nbsp;&nbsp;&nbsp;{$t['year']}</td></tr>\\n<tr>\\n\";\r\n\t\tfor ($j = 0;$j <= 6;$j++) {\r\n\t\t\t$this->content[].=\"<th class=\\\"calendar_title\\\">\";\r\n\t\t\t$this->content[].=\"{$this->day_name[$j]}\";\r\n\t\t\t$this->content[].=\"</th>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</tr>\\n\";\r\n\r\n\t\t// Day row\r\n\t\t// A month is displayed on 6 rows\r\n\t\t// except for a 28 days month starting on Monday\r\n\t\tif (($last_mday == 28) and ($first_wday == 0))\r\n\t\t$jmax = 27;\r\n\t\telse\r\n\t\t$jmax = 41;\r\n\r\n\t\tfor ($j = 0;$j <= $jmax;$j++) {\r\n\t\t\t# Start new row on Monday\r\n\t\t\tif ($j % 7 == 0)\r\n\t\t\t$this->content[].=\"<tr>\\n\";\r\n\r\n\t\t\t// Title colour for current day and checking week end days\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 == 6)) // if today and weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title_we\\\">\";\r\n\r\n\t\t\tif (($j % 7 == 6) and ($j != $today+$first_wday-1)) // if weekend day and not today\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day_we\\\">\";\r\n\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 != 6)) // if today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title\\\">\";\r\n\r\n\t\t\tif (($j % 7 != 6) and ($j != $today+$first_wday-1)) // if not today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day\\\">\";\r\n\r\n\t\t\tif (($j<$first_wday) or ($j>=$last_mday + $first_wday)) {\r\n\r\n\t\t\t\t# Empty boxes\r\n\t\t\t\t$this->content[].=\"&nbsp;\";\r\n\t\t\t} else {\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\techo $cb(mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\t$this->content[].=date($this->date_format, mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\t$this->content[].=\"</a>\\n\";\r\n\t\t\t}\r\n\t\t\t$this->content[].=\"</td>\\n\";\r\n\r\n\t\t\t# End of row on Sunday\r\n\t\t\tif ($j % 7 == 6)\r\n\t\t\t$this->content[].=\"</tr>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</table>\\n\";\r\n\t}", "function draw_calendar($month,$year,$activityStartDateArray = array()){\r\n\r\n\t/* draw table */\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\r\n\t/* table headings */\r\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t/* days and weeks vars now ... */\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t/* row for week one */\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\t/* print \"blank\" days until the first of the current week */\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\t/* keep going with days.... */\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\">';\r\n\t\t\t/* add in the day number */\r\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\r\n\t\t\t\r\n\t\t\t//eventdate=startdate and enddate, depends which we talks about \r\n\r\n\t\t\t$startDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\t//$endDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\techo \"<br>the start date is\".$startDate;\r\n\t\t\t//something is wrong wit hteh startDate, the origin code has a while loop in the beginning, think why \r\n\t\t\t\r\n\t\t\tif(isset($activityStartDateArray[$startDate])) {\r\n\t\t\t\tforeach($activityStartDateArray[$startDate] as $activity) {\r\n\t\t\t\t\t$calendar.= '<div class=\"activity\">'.$activity['activityName'].'</div>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\telse {\r\n\t\t\t\t$calendar.= str_repeat('<p>&nbsp;</p>',2);\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\t\r\n\t\r\n\t/* finish the rest of the days in the week */\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t/* final row */\r\n\t$calendar.= '</tr>';\r\n\t\r\n\r\n\t/* end the table */\r\n\t$calendar.= '</table>';\r\n\r\n\t/** DEBUG **/\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\t\r\n\t/* all done, return result */\r\n\treturn $calendar;\r\n}", "function DisplayCalendarOfEvents()\r\n\t{\r\n\t\tglobal $_SETTINGS;\r\n\t\techo \"<div id='calendar'></div>\";\t\r\n\t}", "function draw_calendar($month,$year,$events = array()){\n\t\t$dayofweek = array('<td class=\"calendar-header\">Sunday</td>',\n\t\t'<td class=\"calendar-header\">Monday</td>',\n\t\t'<td class=\"calendar-header\">Tuesday</td>',\n\t\t'<td class=\"calendar-header\">Wednesday</td>',\n\t\t'<td class=\"calendar-header\">Thursday</td>',\n\t\t'<td class=\"calendar-header\">Friday</td>',\n\t\t'<td class=\"calendar-header\">Saturday</td>');\n\t\t\n\t\t/* draw table\n\t\t\t- fill top row with array using implode */\n\t\t$calendar = '<table class=\"calendar\"><tr class=\"calendar-row\">'.implode($dayofweek).'</tr>';\n\t\t\n\t\t// mktime(hour,minute,second,month,day,year);\n\t\t// figures out the which day of the week 1st is based on provided $month and $year\n\t\t$startDay = date('w',mktime(0,0,0,$month,1,$year)); // return days of the week\n\t\t$days = cal_days_in_month(CAL_GREGORIAN,$month,$year);\n\t\t$daysFilled;\n\t\t$counter = 0;\n\t\n\t\t/* row 2 */\n\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\n\t\t/* print \"blank\" days until the first of the month */\n\t\tfor($i = 0; $i < $startDay; $i++){\n\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\t$daysFilled++;\n\t\t}\n\t\n\t\t/* for loop to add days */\n\t\tfor($i = 1; $i <= $days; $i++):\n\t\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\"><div class=\"date\">'.$i.'</div>';\n\t\t\t\n\t\t\tif ($i < 10){\n\t\t\t\t$i = \"0\".$i;\n\t\t\t}\n\t\t\t\n\t\t\t// input event into calendar\n\t\t\t$eventDay = $year.'-'.$month.'-'.$i;\n\t\t\t\tif(isset($events[$eventDay])) { // if there are events on $eventDay\n\t\t\t\t\tforeach($events[$eventDay] as $eventid) { // for each event, add to calendar\n\t\t\t\t\t\t$mysql = new mysql();\n\t\t\t\t\t\t$tripdetail = $mysql->get_specifictrip($eventid);\n\t\t\t\t\t\t$calendar.= '<div class=\"event\"';\n\t\t\t\t\t\tif($tripdetail[approval]==0){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#FF6666;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($tripdetail[approval]==-1){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#6666E0; text-decoration:line-through;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$calendar.='><a style=\"text-decoration:none; color:inherit;\" href=\"?page=detail2&trip='.$tripdetail[eventid].'\"';\n\t\t\t\t\t\t$calendar.='>'.$tripdetail[destination].'</div>';\n\t\t\t\t\t}\n\t\t\t\t\t$calendar.='</td>';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\t$calendar.= '<p> </p><p> </p></div></td>';\n\t\t\t\t}\n\n\t\t\tif($startDay == 6){ // if the month starts on Saturday, end current row\n\t\t\t\t$calendar.= '</tr>';\n\t\t\t\tif(($counter+1) != $days){ // if there are still days left to fill, new row\n\t\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\t}\n\t\t\t\t$startDay = -1;\n\t\t\t\t$daysFilled = 0;\n\t\t\t}\n\t\t\t$daysFilled++;\n\t\t\t$startDay++;\n\t\t\t$counter++;\n\t\tendfor;\n\t\n\t\t// finish filling in the rest of the days with blanks\n\t\tif($daysFilled < 8 && $daysFilled !=1):\n\t\t\tfor($x = 1; $x <= (8 - $daysFilled); $x++):\n\t\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\tendfor;\n\t\tendif;\n\t\n\t\t// end row, table\n\t\t$calendar.= '</tr></table>';\n\t\t\n\t\t\n\t\t// return HTML code for calendar\n\t\treturn $calendar;\n\t}", "Public static function displayCalender($array)\n {\n echo \"Sun Mon Tue Wed Thu Fri Sat\\n\";\n for ($i = 0; $i < 6; $i++) \n {\n for ($j = 0; $j < 7; $j++) \n {\n if ($array[$i][$j] == '-' || $array[$i][$j] > 31) \n {\n //replacing with spaces\n echo \" \";\n } \n else \n {\n if ($array[$i][$j] < 10) \n {\n //giving 5 space after single digit\n echo $array[$i][$j] . \" \";\n } \n else \n {\n //giving 4 space after two digit number\n echo $array[$i][$j] . \" \";\n }\n }\n }\n echo \"\\n\";\n }\n }", "public function buildCalendarList(){\n\t\t\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'list';\n\t\t\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\" class=\"calendar_list\">\n <?php echo $this->buildCalendarHead() ?>\n <tr>\n <td>\n <?php \n /*** CURRENT MONTH CELLS ***/\n $first_day = $this->getYear() . '-' . $this->getMonth() . '-01';\n $last_day = $this->getYear() . '-' . $this->getMonth() . '-' . $current_number_of_days;\n \n $object = $this->events_ob;\n $month_events = new $object();\n $month_events = $month_events->fetchAll(\"WHERE DATE(\" . $this->events_end_date_field . \") >= '\" . $first_day . \"' AND DATE(\" . $this->events_end_date_field . \") <= '\" . $last_day . \"'\", \"ORDER BY `\" . $this->events_end_date_field . \"` DESC\");\n \n if(count($month_events) > 0){\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n \n $events = $this->buildDayList($full_date);\t//get events for each day\n if(strlen(trim($events))){\n ?>\n <div class=\"day\">\n <?php echo $events; ?>\n </div>\n <?php\n }\n }\n }\n else{?>\n \t\t<h5><?php echo 'No events in ' . $this->getMonthName() . ' ' . $this->getYear();?></h5>\n <?php\n }\n ?> \n </td>\n </tr>\n </table>\n <?php\n return ob_get_clean();\n\t}", "function calendar()\n{\n /*\n $groups = getAllEvents();\n $fieldsToConvert = [\"name\", \"description\", \"context\", \"status\"];\n $groups = specialCharsConvertFromAnArray($groups, $fieldsToConvert);\n displaydebug($groups);\n */\n require_once \"view/calendar.php\";\n}", "private function makeDayEventListArray()\n\t{\n\t\t$outevents = array();\n\t\t$n = 0;\n\t\tforeach($this->eventItems as $item) {\n\t\t\tif($item['date'] == $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth) {\t\t\n\t\t\t\t$outevents[$n]['category'] = $item['cat'];\n\t\t\t\t\n\t\t\t\tif($item['stdurl']) {\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'].'?id='.$item['id'];\n\t\t\t\t} else {\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$outevents[$n]['summary'] = $item['text'];\n\t\t\t\t$outevents[$n]['description'] = $item['desc'];\n\t\t\t\t$outevents[$n]['categorycolor'] = (strlen($item['catcolor']) > 0 ? str_replace('#','',$item['catcolor']) : '#eeeeee');\n\t\t\t}\n\t\t\t$n++;\n\t\t}\n\t\t\n\t\tif(count($outevents)) {\n\t\t\treturn $outevents;\n\t\t}\n\t\treturn false;\n\t}", "Public function getEvents()\n\t{\n\t\t$result=$this->M_calendar->getEvents();\n\t\techo json_encode($result);\n\t}", "public function calendar($year_month = null) {\n\n if(!isset($year_month)) {\n /* Setting the data and creating the first and last day of a month */\n $start_date = date('Y-m-01');\n $end_date = date('Y-m-t');\n }\n else {\n /* Getting the data and creating the first and last day of a month */\n $start_date = date('Y-m-d', strtotime($year_month.'-01'));\n $end_date = date('Y-m-t', strtotime($year_month.'-01'));\n }\n\n /* Querying the database to get the events for all days of certain month of the year */\n $calendar = [];\n $activities = [];\n while($start_date <= $end_date) {\n\n //Temporalmente, pedido por Amparo, ¿Qué te dije?, igual y mañana se queja de que se ven los eventos sin aprobar :P\n /*\n $events = EventDCI::whereRaw('end_day >= ? and start_day <= ? and (dci_status = ? or dci_status = ?) and user_status = ?',\n array($start_date, $start_date, 'En Proceso', 'Aprobado', 'Activo'))\n ->orderBy('time')->get();\n */\n $events = EventDCI::whereRaw('end_day >= ? and start_day <= ?',\n array($start_date, $start_date))\n ->orderBy('time')->get();\n\n $activities['activities'] = $events->toArray();\n\n //ola k ase\n $activities['date'] = $start_date;\n\n array_push($calendar, $activities);\n $activities = [];\n\n $next_date = new DateTime($start_date);\n $next_date->add(new DateInterval('P1D'));\n $s_next_date = $next_date->format('Y-m-d');\n $start_date = explode(' ', $s_next_date)[0];\n }\n\n return json_encode($calendar);\n\n }", "public function mostrarCalendarioCumpleaños(){\n\t\t$item1 = \"fch_nacimiento\";\n\t\tif($_POST[\"start\"] > $_POST[\"end\"] && $_POST[\"start\"] == 12){\n\t\t\t$inicio = 1;\n\t\t\t$fin = $_POST[\"end\"];\n\t\t}else if($_POST[\"start\"] > $_POST[\"end\"] && $_POST[\"end\"] == 1){\n\t\t\t$inicio = $_POST[\"start\"];\n\t\t\t$fin = 12;\n\t\t}else{\n\t\t\t$inicio = $_POST[\"start\"];\n\t\t\t$fin = $_POST[\"end\"];\n\t\t}\n $valor1 = $inicio.'|'.$fin;\n $item2 = $valor2 = $item3 = $valor3 = null;\n $entrada = \"calendarioCumpleaños\";\n $cumpleaños = ControladorTrabajador::ctrMostrarTrabajador($item1,$valor1,$item2,$valor2,$item3,$valor3,$entrada);\n if(count($cumpleaños) > 0){\n\t $datosJson = '[';\n\t\t\t\t \tfor ($i=0; $i < count($cumpleaños) ; $i++) {\n\t\t\t\t \t\t$fechaNacimiento = dateFormatCumpleanios($cumpleaños[$i][\"fch_nacimiento\"]);\n\t\t\t\t \t\t$datosJson .= '{\n\t\t\t\t\t\t\t\"nombre\" : \"'.$cumpleaños[$i][\"dsc_nombres\"].\" \".$cumpleaños[$i][\"dsc_apellido_paterno\"].\" \".$cumpleaños[$i][\"dsc_apellido_materno\"].'\",\n\t\t\t\t\t\t\t\"fecha\" : \"'.$fechaNacimiento.'\",\n\t\t\t\t\t\t\t\"imagen\" : \"'.$cumpleaños[$i][\"imagen\"].'\",\n\t\t\t\t\t\t\t\"cargo\" : \"'.$cumpleaños[$i][\"dsc_cargo\"].'\"\n\t\t\t\t\t\t},';\n\t\t\t\t\t}\t\t\t \t\n\t\t\t\t\t$datosJson = substr($datosJson, 0, -1);\n\t\t\t\t$datosJson .= ']';\t\n\t\t}else{\n\t\t\t$datosJson = '[\n\t\t\t\t{}\n\t\t\t]';\n\t\t}\n\t\techo $datosJson;\t\n\t}", "public function getCalendarPage();", "function draw_calendar($month,$year,$cal,$available_list,$price_list){\n\n /* draw table */\n $calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n /* table headings */\n $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n $calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n $dates_array = array();\n\n /* row for week one */\n $calendar.= '<tr class=\"calendar-row\">';\n\n /* print \"blank\" days until the first of the current week */\n for($x = 0; $x < $running_day; $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n $days_in_this_week++;\n endfor;\n\n /* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n // echo \" cal: \".($available_list[$list_day - 1] == 't').\"\\n\";\n if ($available_list[$list_day - 1] == 't')\n {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#00FF00\">';\n } else {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#FF0000\">';\n\n }\n \n\n /* add in the day number */\n $calendar.= '<div class=\"day-number\" ><font size=\"+3\">'.$list_day.\"</font> \".$price_list[$list_day-1].'</div>';\n\n /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n $calendar.= str_repeat('<p> </p>',2);\n \n $calendar.= '</td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n endfor;\n\n /* finish the rest of the days in the week */\n if($days_in_this_week < 8):\n for($x = 1; $x <= (8 - $days_in_this_week); $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n endfor;\n endif;\n\n /* final row */\n $calendar.= '</tr>';\n\n /* end the table */\n $calendar.= '</table>';\n \n /* all done, return result */\n return $calendar;\n }", "public function getOutput()\n\t{\n\t\tif( ! IPSLib::appIsInstalled( 'calendar' ) )\n\t\t{\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t/* Load language */\n\t\t$this->registry->class_localization->loadLanguageFile( array( 'public_calendar' ), 'calendar' );\n\n\t\t/* Load calendar library */\n\t\t$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'calendar' ) .'/modules_public/calendar/view.php', 'public_calendar_calendar_view' );\n\t\t$cal = new $classToLoad();\n\t\t$cal->makeRegistryShortcuts( $this->registry );\n\t\t\n\t\tif( !$cal->initCalendar( true ) )\n\t\t{\n\t\t\treturn '';\n\t\t}\n\n\t\t/* Return calendar */\n\t\treturn \"<div id='hook_calendar' class='calendar_wrap'>\". $cal->getMiniCalendar( date('n'), date('Y') ) . '</div><br />';\n\t}", "function build_calendar($month,$year,$dateArray) {\r\n $daysOfWeek = array('S','M','T','W','T','F','S');\r\n\r\n // What is the first day of the month in question?\r\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\r\n\r\n // How many days does this month contain?\r\n $numberDays = date('t',$firstDayOfMonth);\r\n\r\n // Retrieve some information about the first day of the\r\n // month in question.\r\n $dateComponents = getdate($firstDayOfMonth);\r\n\r\n // What is the name of the month in question?\r\n $monthName = $dateComponents['month'];\r\n\r\n // What is the index value (0-6) of the first day of the\r\n // month in question.\r\n $dayOfWeek = $dateComponents['wday'];\r\n\r\n // Create the table tag opener and day headers\r\n\r\n $calendar = \"<table class='table table-bordered'>\";\r\n $calendar .= \"<caption>$monthName $year</caption>\";\r\n $calendar .= \"<tr>\";\r\n\r\n // Create the calendar headers\r\n\r\n foreach($daysOfWeek as $day) {\r\n $calendar .= \"<th class='header'>$day</th>\";\r\n } \r\n\r\n // Create the rest of the calendar\r\n\r\n // Initiate the day counter, starting with the 1st.\r\n\r\n $currentDay = 1;\r\n\r\n $calendar .= \"</tr><tr>\";\r\n\r\n // The variable $dayOfWeek is used to\r\n // ensure that the calendar\r\n // display consists of exactly 7 columns.\r\n\r\n if ($dayOfWeek > 0) { \r\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\"; \r\n }\r\n \r\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\r\n \r\n while ($currentDay <= $numberDays) {\r\n\r\n // Seventh column (Saturday) reached. Start a new row.\r\n\r\n if ($dayOfWeek == 7) {\r\n\r\n $dayOfWeek = 0;\r\n $calendar .= \"</tr><tr>\";\r\n\r\n }\r\n \r\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\r\n \r\n $date = \"$year-$month-$currentDayRel\";\r\n\t\tif($date == date('Y-m-d')){\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date' bgcolor='#ADD8E6'>$currentDay<br/>\";\r\n\t\t}else{\r\n\t\t\t$calendar .= \"<td class='col-md-1 col-xs-1' rel='$date'>$currentDay<br/>\";\r\n\t\t}\r\n \r\n\t\t $sql = mysql_query(\"SELECT * FROM leavesys.leave_details WHERE date = '\".$date.\"'\");\r\n\t\t while($result = mysql_fetch_array($sql)){\r\n\t\t\t $sql2 = mysql_query(\"SELECT * FROM user WHERE id = '\".$result['applicant_id'].\"'\");\r\n\t\t\t $result2 = mysql_fetch_assoc($sql2);\r\n\t\t\t\tif($result['half'] == 1){\r\n\t\t\t\t\t$c_content = \" (am)\";\r\n\t\t\t\t}else if($result['half'] == 2){\r\n\t\t\t\t\t$c_content = \" (pm)\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$c_content = \"\";\r\n\t\t\t\t}\r\n\t\t\t\t$calendar .= $result2['country_code'].\" - \".$result2['name'].$c_content.\"<br/>\";\r\n\t\t }\r\n\t\t $sql1 = mysql_query(\"SELECT * FROM leavesys.holiday WHERE date = '\".$date.\"'\");\r\n\t\t while($result1 = mysql_fetch_array($sql1)){\r\n\t\t\t if($result1['country'] == \"al\"){\r\n\t\t\t\t $calendar .= \"<font color='blue;'>\".$result1['name'].\"</font><br/>\";\r\n\t\t\t }else{\r\n\t\t\t\t$calendar .= \"<font color='blue;'>\".$result1['name'].\" (\".$result1['country'].\")</font><br/>\";\r\n\t\t\t }\r\n\t\t }\r\n\t\t $calendar .= \"</td>\";\r\n\r\n // Increment counters\r\n \r\n $currentDay++;\r\n $dayOfWeek++;\r\n\r\n }\r\n \r\n \r\n\r\n // Complete the row of the last week in month, if necessary\r\n\r\n if ($dayOfWeek != 7) { \r\n \r\n $remainingDays = 7 - $dayOfWeek;\r\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\"; \r\n\r\n }\r\n \r\n $calendar .= \"</tr>\";\r\n\r\n $calendar .= \"</table>\";\r\n\r\n return $calendar;\r\n\r\n}", "public static function initialize_calendar(){\n \n $event_array[] = array();\n $schedules = \\App\\Event::get();\n if(!empty($schedules)){\n foreach($schedules as $schedule){\n $event_array[] = array(\n 'id' => uniqid(),\n 'title' => $schedule->description,\n 'start' => date('Y-m-d', strtotime($schedule->event_date)),\n 'end' => date('Y-m-d', strtotime($schedule->event_date)),\n 'color' => \"lightblue\",\n \"textEscape\"=> 'false' ,\n 'textColor' => 'black',\n );\n }\n return $get_schedule = json_encode($event_array);\n }\n }", "public function dayList()\n\t{\n\t\techo json_encode($this->sched_day->fetchData());\n\t}", "function build_calendar($month,$year,$dateArray) {\n $daysOfWeek = array('S','M','T','W','T','F','S');\n\n // What is the first day of the month in question?\n $firstDayOfMonth = mktime(0,0,0,$month,1,$year);\n\n // How many days does this month contain?\n $numberDays = date('t',$firstDayOfMonth);\n\n // Retrieve some information about the first day of the\n // month in question.\n $dateComponents = getdate($firstDayOfMonth);\n\n // What is the name of the month in question?\n $monthName = $dateComponents['month'];\n\n // What is the index value (0-6) of the first day of the\n // month in question.\n $dayOfWeek = $dateComponents['wday'];\n\n // Create the table tag opener and day headers\n\n $calendar = \"<table class='calendar'>\";\n $calendar .= \"<caption>$monthName $year</caption>\";\n $calendar .= \"<tr>\";\n\n // Create the calendar headers\n\n foreach($daysOfWeek as $day) {\n $calendar .= \"<th class='header'>$day</th>\";\n }\n\n // Create the rest of the calendar\n\n // Initiate the day counter, starting with the 1st.\n\n $currentDay = 1;\n\n $calendar .= \"</tr><tr>\";\n\n // The variable $dayOfWeek is used to\n // ensure that the calendar\n // display consists of exactly 7 columns.\n\n if ($dayOfWeek > 0) {\n $calendar .= \"<td colspan='$dayOfWeek'>&nbsp;</td>\";\n }\n\n $month = str_pad($month, 2, \"0\", STR_PAD_LEFT);\n\n while ($currentDay <= $numberDays) {\n\n // Seventh column (Saturday) reached. Start a new row.\n\n if ($dayOfWeek == 7) {\n\n $dayOfWeek = 0;\n $calendar .= \"</tr><tr>\";\n\n }\n\n $currentDayRel = str_pad($currentDay, 2, \"0\", STR_PAD_LEFT);\n\n $date = \"$year-$month-$currentDayRel\";\n\n $calendar .= \"<td class='day' rel='$date'>$currentDay</td>\";\n\n // Increment counters\n\n $currentDay++;\n $dayOfWeek++;\n\n }\n\n\n\n // Complete the row of the last week in month, if necessary\n\n if ($dayOfWeek != 7) {\n\n $remainingDays = 7 - $dayOfWeek;\n $calendar .= \"<td colspan='$remainingDays'>&nbsp;</td>\";\n\n }\n\n $calendar .= \"</tr>\";\n\n $calendar .= \"</table>\";\n\n return $calendar;\n\n}", "private function getData()\n {\n $data = array();\n\n $data = array_merge($data,\n $this->services->CalendarData->currentUserData(),\n $this->services->Common->subPageName( $this->timber->translator->trans('Calendar') . \" | \" ),\n $this->services->Common->runtimeScripts( 'calendar' ),\n $this->services->Common->injectScripts(array(\n 'projectsEvents' => $this->services->CalendarData->projectsEvents(),\n 'tasksEvents' => $this->services->CalendarData->tasksEvents(),\n 'projectsEventsColor' => '#ecf0f1',\n 'projectsEventsTextColor' => '#2c3e50',\n 'tasksEventsColor' => '#bdc3c7',\n 'tasksEventsTextColor' => '#2980b9',\n 'calEvent_id' => $this->timber->translator->trans('ID'),\n 'calEvent_iden' => $this->timber->translator->trans('Identifier'),\n 'calEvent_type' => $this->timber->translator->trans('Type'),\n 'calEvent_mi_id' => $this->timber->translator->trans('Milestone ID'),\n 'calEvent_mi_title' => $this->timber->translator->trans('Milestone Title'),\n 'calEvent_pr_id' => $this->timber->translator->trans('Project ID'),\n 'calEvent_owner_id' => $this->timber->translator->trans('Owner ID'),\n 'calEvent_assign_to' => $this->timber->translator->trans('Assignee ID'),\n 'calEvent_assign_to_name' => $this->timber->translator->trans('Assignee Name'),\n 'calEvent_assign_to_email' => $this->timber->translator->trans('Assignee Email'),\n 'calEvent_title' => $this->timber->translator->trans('Title'),\n 'calEvent_description' => $this->timber->translator->trans('Description'),\n 'calEvent_status' => $this->timber->translator->trans('Status'),\n 'calEvent_progress' => $this->timber->translator->trans('Progress'),\n 'calEvent_priority' => $this->timber->translator->trans('Priority'),\n 'calEvent_start_at' => $this->timber->translator->trans('Start at'),\n 'calEvent_end_at' => $this->timber->translator->trans('End at'),\n 'calEvent_created_at' => $this->timber->translator->trans('Created at'),\n 'calEvent_updated_at' => $this->timber->translator->trans('Updated at'),\n 'calEvent_currency' => $this->timber->translator->trans('Currency'),\n 'calEvent_reference' => $this->timber->translator->trans('Reference'),\n 'calEvent_ref_id' => $this->timber->translator->trans('Reference ID'),\n 'calEvent_version' => $this->timber->translator->trans('Version'),\n 'calEvent_budget' => $this->timber->translator->trans('Budget'),\n 'calEvent_tax_value' => $this->timber->translator->trans('Tax Value'),\n 'calEvent_tax_type' => $this->timber->translator->trans('Tax Type'),\n 'calEvent_discount_value' => $this->timber->translator->trans('Discount Value'),\n 'calEvent_discount_type' => $this->timber->translator->trans('Discount Type'),\n 'calEvent_attach' => $this->timber->translator->trans('Attachments'),\n 'calEvent_owners' => $this->timber->translator->trans('Owners'),\n 'calEvent_staff' => $this->timber->translator->trans('Staff'),\n 'calEvent_clients' => $this->timber->translator->trans('Clients'),\n 'calEvent_staff_ids' => $this->timber->translator->trans('Staff IDs'),\n 'calEvent_clients_ids' => $this->timber->translator->trans('Clients IDs'),\n ))\n );\n\n return $data;\n }", "public function calendar(){\n\n /**\n * Hago una consulta a la tabla eventos para que me traiga los eventos\n * que esten activos y le pido que me lo convierta a array\n */\n $events = Event::query()->where('state','Activo')->get()->toArray();\n\n /**\n * Creo un array vacio\n */\n $eventos = array();\n\n /**\n * Recorro cada uno de los elementos de la consulta que hice antes con un foreach\n * y los guardo en un array, en la posicion title guardo el titulo y la descripcion\n * y la fecha la guardo en la posicion start, ya que asi me la pide el fullcalendar\n */\n foreach($events as $event){\n $evento = [\n 'title' => $event['title'].\" | \".$event['description'],\n 'start' => $event['date'],\n ];\n /**\n * Guardo el array anterior en el array vacio que cree antes\n */\n array_push($eventos,$evento);\n }\n return view('calendar' , compact('eventos'));\n }", "function dateContent() {\n\t\t//printvar(func_get_arg());\n\t\tif (func_num_args() >= 2) {\n\t\t\t$day = intval(func_get_arg(0));\n\t\t\t$content = trim(func_get_arg(1));\n\t\t\t\n\t\t\tif ($day >= 1 && $day <= 31) {\n\t\t\t\t$this->_dateArray[$day] = $content;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telseif (func_num_args() == 1) {\n\t\t\t$day = intval(func_get_arg(0));\n\t\t\t\n\t\t\tif (array_key_exists($day,$this->_dateArray)) {\n\t\t\t\treturn $this->_fillContent($this->_dateArray[$day]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t} \n\t\telse {\n\t\t\treturn $this->_dateArray;\n\t\t\t//user_error(\"You must pass at least one argument to the dateContent function of the Calendar class\", E_NOTICE);\n\t\t}\n\t}", "public function generate() {\n\t\tif(!isset($this->year)) {\n\t\t\t$this->year = date(\"Y\");\n\t\t}\n\t\tif(!isset($this->month)) {\n\t\t\t$this->month = date(\"m\");\n\t\t}\n\t\treturn $this->generate_calendar($this->year, $this->month);\n\t}", "public function get_all_data()\n\t{\n\treturn $this->cal;\n\t}", "public function calendarIndex()\n {\n return view('calendar');\n }" ]
[ "0.6879275", "0.6866407", "0.6681683", "0.66030675", "0.6585608", "0.65136975", "0.6499322", "0.6464244", "0.6386328", "0.636859", "0.6288093", "0.6283444", "0.6279114", "0.62678814", "0.6267044", "0.62599", "0.6204513", "0.61667717", "0.6158972", "0.6122414", "0.6097351", "0.60933614", "0.6081944", "0.6081", "0.6080307", "0.60789603", "0.6073175", "0.60688347", "0.60653496", "0.6039304" ]
0.74939036
0
Generic method to draw the calendar Outputs the HTML for drawing the calendar table.
public function drawHTML() { $this->calWeekDays .= "<table border=\"1\">\n"; $this->makeCalendarTitle(); $this->makeCalendarHead(); $this->makeDayHeadings(); $this->calWeekDays .= "\t<tr>\n"; $this->startMonthSpacers(); $this->makeHTMLIterator(); $this->endMonthSpacers(); $this->calWeekDays .= "\t</tr>\n"; $this->calWeekDays .= "</table>\n"; echo $this->calWeekDays; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_calendar() // Generating calendar HTML content\r\n\t{\r\n\t\t# Apparently, it's not possible to dereference $this->callback()\r\n\t\t$cb = $this->callback;\r\n\r\n\t\t# Preliminary calculations\r\n\t\t$t = getdate(strtotime($this->date));\r\n\t\t$today = $t[\"mday\"];\r\n\t\t$year = $t[\"year\"];\r\n\t\t$month = $t[\"mon\"];\r\n\t\t# Get first day of the month (monday = 0)\r\n\t\t$first_wday = ((int) date(\"w\", mktime(0, 0, 0, $month, 1, $year))+6)%7;\r\n\t\t# Last day of the month\r\n\t\t$last_mday = (int) date(\"d\", mktime(0, 0, 0, $month+1, 0, $year));\r\n\r\n\t\t# Anchor\r\n\t\t//$this->content[].=\"<a name=\\\"calendar\\\">\";\r\n\r\n\t\t# Table\r\n\t\t$this->content[].=\"<table width=\\\"100%\\\" align=\\\"center\\\" cellpadding=\\\"0\\\" cellspacing=\\\"2\\\" class=\\\"calendar\\\">\\n\";\r\n\r\n\t\t# Table head\r\n\t\t$this->content[].=\"<tr><td colspan=\\\"7\\\" class=\\\"calendar_header\\\">{$this->month_name[$month - 1]}&nbsp;&nbsp;&nbsp;{$t['year']}</td></tr>\\n<tr>\\n\";\r\n\t\tfor ($j = 0;$j <= 6;$j++) {\r\n\t\t\t$this->content[].=\"<th class=\\\"calendar_title\\\">\";\r\n\t\t\t$this->content[].=\"{$this->day_name[$j]}\";\r\n\t\t\t$this->content[].=\"</th>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</tr>\\n\";\r\n\r\n\t\t// Day row\r\n\t\t// A month is displayed on 6 rows\r\n\t\t// except for a 28 days month starting on Monday\r\n\t\tif (($last_mday == 28) and ($first_wday == 0))\r\n\t\t$jmax = 27;\r\n\t\telse\r\n\t\t$jmax = 41;\r\n\r\n\t\tfor ($j = 0;$j <= $jmax;$j++) {\r\n\t\t\t# Start new row on Monday\r\n\t\t\tif ($j % 7 == 0)\r\n\t\t\t$this->content[].=\"<tr>\\n\";\r\n\r\n\t\t\t// Title colour for current day and checking week end days\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 == 6)) // if today and weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title_we\\\">\";\r\n\r\n\t\t\tif (($j % 7 == 6) and ($j != $today+$first_wday-1)) // if weekend day and not today\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day_we\\\">\";\r\n\r\n\r\n\t\t\tif (($j == $today+$first_wday-1) and ($j % 7 != 6)) // if today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_title\\\">\";\r\n\r\n\t\t\tif (($j % 7 != 6) and ($j != $today+$first_wday-1)) // if not today and not weekend day\r\n\t\t\t$this->content[].=\"<td class=\\\"calendar_day\\\">\";\r\n\r\n\t\t\tif (($j<$first_wday) or ($j>=$last_mday + $first_wday)) {\r\n\r\n\t\t\t\t# Empty boxes\r\n\t\t\t\t$this->content[].=\"&nbsp;\";\r\n\t\t\t} else {\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\techo $cb(mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\t$this->content[].=date($this->date_format, mktime(0, 0, 0, $month, $j - $first_wday + 1, $year));\r\n\t\t\t\tif (isset($cb))\r\n\t\t\t\t$this->content[].=\"</a>\\n\";\r\n\t\t\t}\r\n\t\t\t$this->content[].=\"</td>\\n\";\r\n\r\n\t\t\t# End of row on Sunday\r\n\t\t\tif ($j % 7 == 6)\r\n\t\t\t$this->content[].=\"</tr>\\n\";\r\n\t\t}\r\n\t\t$this->content[].=\"</table>\\n\";\r\n\t}", "function draw_calendar($month,$year,$events = array()){\n\t\t$dayofweek = array('<td class=\"calendar-header\">Sunday</td>',\n\t\t'<td class=\"calendar-header\">Monday</td>',\n\t\t'<td class=\"calendar-header\">Tuesday</td>',\n\t\t'<td class=\"calendar-header\">Wednesday</td>',\n\t\t'<td class=\"calendar-header\">Thursday</td>',\n\t\t'<td class=\"calendar-header\">Friday</td>',\n\t\t'<td class=\"calendar-header\">Saturday</td>');\n\t\t\n\t\t/* draw table\n\t\t\t- fill top row with array using implode */\n\t\t$calendar = '<table class=\"calendar\"><tr class=\"calendar-row\">'.implode($dayofweek).'</tr>';\n\t\t\n\t\t// mktime(hour,minute,second,month,day,year);\n\t\t// figures out the which day of the week 1st is based on provided $month and $year\n\t\t$startDay = date('w',mktime(0,0,0,$month,1,$year)); // return days of the week\n\t\t$days = cal_days_in_month(CAL_GREGORIAN,$month,$year);\n\t\t$daysFilled;\n\t\t$counter = 0;\n\t\n\t\t/* row 2 */\n\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\n\t\t/* print \"blank\" days until the first of the month */\n\t\tfor($i = 0; $i < $startDay; $i++){\n\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\t$daysFilled++;\n\t\t}\n\t\n\t\t/* for loop to add days */\n\t\tfor($i = 1; $i <= $days; $i++):\n\t\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\"><div class=\"date\">'.$i.'</div>';\n\t\t\t\n\t\t\tif ($i < 10){\n\t\t\t\t$i = \"0\".$i;\n\t\t\t}\n\t\t\t\n\t\t\t// input event into calendar\n\t\t\t$eventDay = $year.'-'.$month.'-'.$i;\n\t\t\t\tif(isset($events[$eventDay])) { // if there are events on $eventDay\n\t\t\t\t\tforeach($events[$eventDay] as $eventid) { // for each event, add to calendar\n\t\t\t\t\t\t$mysql = new mysql();\n\t\t\t\t\t\t$tripdetail = $mysql->get_specifictrip($eventid);\n\t\t\t\t\t\t$calendar.= '<div class=\"event\"';\n\t\t\t\t\t\tif($tripdetail[approval]==0){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#FF6666;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($tripdetail[approval]==-1){\n\t\t\t\t\t\t\t$calendar.=' style=\"color:#6666E0; text-decoration:line-through;\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$calendar.='><a style=\"text-decoration:none; color:inherit;\" href=\"?page=detail2&trip='.$tripdetail[eventid].'\"';\n\t\t\t\t\t\t$calendar.='>'.$tripdetail[destination].'</div>';\n\t\t\t\t\t}\n\t\t\t\t\t$calendar.='</td>';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\t$calendar.= '<p> </p><p> </p></div></td>';\n\t\t\t\t}\n\n\t\t\tif($startDay == 6){ // if the month starts on Saturday, end current row\n\t\t\t\t$calendar.= '</tr>';\n\t\t\t\tif(($counter+1) != $days){ // if there are still days left to fill, new row\n\t\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\t}\n\t\t\t\t$startDay = -1;\n\t\t\t\t$daysFilled = 0;\n\t\t\t}\n\t\t\t$daysFilled++;\n\t\t\t$startDay++;\n\t\t\t$counter++;\n\t\tendfor;\n\t\n\t\t// finish filling in the rest of the days with blanks\n\t\tif($daysFilled < 8 && $daysFilled !=1):\n\t\t\tfor($x = 1; $x <= (8 - $daysFilled); $x++):\n\t\t\t\t$calendar.= '<td class=\"calendar-empty\"> </td>';\n\t\t\tendfor;\n\t\tendif;\n\t\n\t\t// end row, table\n\t\t$calendar.= '</tr></table>';\n\t\t\n\t\t\n\t\t// return HTML code for calendar\n\t\treturn $calendar;\n\t}", "function draw_calendar($month,$year,$cal,$available_list,$price_list){\n\n /* draw table */\n $calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n /* table headings */\n $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n $calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n $dates_array = array();\n\n /* row for week one */\n $calendar.= '<tr class=\"calendar-row\">';\n\n /* print \"blank\" days until the first of the current week */\n for($x = 0; $x < $running_day; $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n $days_in_this_week++;\n endfor;\n\n /* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n // echo \" cal: \".($available_list[$list_day - 1] == 't').\"\\n\";\n if ($available_list[$list_day - 1] == 't')\n {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#00FF00\">';\n } else {\n $calendar.= '<td class=\"calendar-day\" bgcolor=\"#FF0000\">';\n\n }\n \n\n /* add in the day number */\n $calendar.= '<div class=\"day-number\" ><font size=\"+3\">'.$list_day.\"</font> \".$price_list[$list_day-1].'</div>';\n\n /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n $calendar.= str_repeat('<p> </p>',2);\n \n $calendar.= '</td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n endfor;\n\n /* finish the rest of the days in the week */\n if($days_in_this_week < 8):\n for($x = 1; $x <= (8 - $days_in_this_week); $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n endfor;\n endif;\n\n /* final row */\n $calendar.= '</tr>';\n\n /* end the table */\n $calendar.= '</table>';\n \n /* all done, return result */\n return $calendar;\n }", "function draw_calendar($month,$year){\r\n\t/*Naredi koledar*/\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\t\r\n\t$headings = array('Nedelja','Ponedeljek','Torek','Sreda','Cetrtek','Petek','Sobota');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\tif($list_day < 10) {\r\n $list_day = str_pad($list_day, 2, '0', STR_PAD_LEFT);\r\n }\r\n\t\t$month = str_pad($month, 2, '0', STR_PAD_LEFT);\r\n\t\t$event_day = $year.'-'.$month.'-'.$list_day;\r\n\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div name=\"test\" style=\"height:100px; width:120px; overflow: auto; white-space:nowrap\" id=' .$event_day. ' onclick=\"modal(this.id);\">';\r\n\t\t$calendar.= '<div>'.$list_day.'</div>';\t\r\n\t\t$query = \"SELECT CONCAT_WS(' ',s.firstname,s.lastname) as Zaposleni, a.name, aa.aktivnost_id\r\n\t\t\tFROM ost_staff s, ost_agent_aktivnost aa, ost_aktivnosti a\r\n\t\t\tWHERE s.staff_id = aa.staff_id and a.id=aa.aktivnost_id and '$event_day' BETWEEN aa.aktivnost_od AND aa.aktivnost_do AND aa.aktivnost_id > 1 AND aa.aktivnost_id != 9 AND aa.aktivnost_id != 10\";\r\n\t\t\t$result = db_query($query) or die('Ne morem pridobiti rezultata!');\r\n\t\t\twhile($row = db_fetch_array($result)) {\r\n\t\t\t\t$words = explode(' ',$row['Zaposleni']);\r\n\t\t\t\t$calendar .= '<div>'.$words[0][0].'. '.$words[1][0].'. : '.$row['name'].'</div>';\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t$calendar.= '</tr>';\r\n\r\n\t$calendar.= '</table>';\r\n\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\r\n\treturn $calendar;\r\n}", "public function render()\r\n\t{\r\n\t\t$days = 1;\r\n\t\t$this->redirect = isset($this->redirect) ? $this->redirect: $this->getURL() ;\r\n\t\t$this->set_date();\r\n\t\t$total_days = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year);\r\n\t\t$first_spaces = date(\"w\", mktime(0, 0, 0, $this->month, 1, $this->year));\r\n\t\t$currentday = $this->UID('day');\r\n\r\n\t\tif (isset($this->inForm))\r\n\t\t{\r\n\t\t\t$CObjID = $this->UID('calendar');\r\n\t\t\t$DateString = ($this->Value()) ? '\",\"'.$this->Value() : '';\r\n\t\t\t$this->output = '<script language=\"javascript\">'.\"\\n\".'var '.$CObjID.' = new Calendar(\"'.$this->ID.$DateString.'\");'.\"\\n\"\r\n\t\t\t.$CObjID.'.currentDateStyle = \"'.$this->currentDateStyle.'\";'.\"\\n\"\r\n\t\t\t.$CObjID.'.selectedDateStyle = \"'.$this->selectedDateStyle.'\";'.\"\\n\"\r\n\t\t\t.$CObjID.'.normalDateStyle = \"'.$this->normalDateStyle.'\";'.\"\\n\"\r\n\t\t\t.$CObjID.'.setStyles();'.\"\\n\"\r\n\t\t\t.'</script>'.\"\\n\"\r\n\t\t\t.'<input type=\"hidden\" id=\"'.$CObjID.'\" name=\"'.$CObjID.'\" value=\"'.$this->Value().'\"/>'.\"\\n\";\r\n\t\t}\r\n\t\telse $this->output = '';\r\n\r\n\t\t$NavUrls = $this->url_params($this->UID('year'),$this->UID('month'),$this->UID('day'),array_keys($this->add_params_sel));\r\n\r\n\t\t$this->output.= '<table class=\"calendar\"><tr><td class=\"'.$this->navigateStyle.'\"><a id=\"'.$this->UID('navigateback').'\" class=\"'.$this->navigateStyle.'\" href=\"'.$this->getURL().\r\n\t\t\t'?'.$this->add_params_sel().'&'.$this->UID('month').'='.($this->month-1).'&'.$this->UID('year').'='.$this->year.$NavUrls.'\"><</a>\r\n\t\t </td><td id=\"'.$this->UID('Month').'\" colspan=\"5\" class=\"'.$this->monthStyle.'\">'.$this->RUS_MONTHS[date(\"n\", mktime(0, 0, 0, $this->month, 1, $this->year))-1].'&nbsp;'.$this->year.'\r\n\t\t </td><td class=\"'.$this->navigateStyle.'\"><a id=\"'.$this->UID('navigatenext').'\" class=\"'.$this->navigateStyle.'\" href=\"'.$this->getURL().'?'.$this->add_params_sel().'&'.$this->UID('month').'='.($this->month+1).'&'.$this->UID('year').'='.$this->year.$NavUrls.'\">></a>\r\n\t\t </td></tr><tr class=\"'.$this->daysOfTheWeekStyle.'\"><td>Ïí</td><td>Âò</td><td>Ñð</td><td>×ò</td><td>Ïò</td><td>Ñá</td><td>Âñ</td></tr>';\r\n\r\n \tfor ($Week=0;$Week<6;$Week++)\r\n \t{\r\n \t$this->output.= '<tr>';\r\n\r\n\t\t\t\tfor ($Day=0;$Day<7;$Day++)\r\n \t{\r\n\r\n\t\t\t\t\t$days++;\r\n\t\t\t\t\t$dDay = $days - $first_spaces;\r\n\t\t\t\t\t$norm_style = ($this->isDayAvailable($dDay))?$this->availDateStyle:$this->normalDateStyle;\r\n\t\t\t\t\t\r\n//\t\t\t\t\techo('dDay='.$dDay.'<br/>avail dates:');\r\n//\t\t\t\t\tforeach($this->availDates as $date)\r\n//\t\t\t\t\t\techo(date('d/m/Y',$date).'<br/>');\r\n\r\n\t\t\t\t\t$CellID = $this->UID('item['.$days.']');\r\n\r\n\t\t\t\t\tif ($days > $first_spaces && ($dDay) < $total_days + 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$LinkID = $this->UID('hlink['.$days.']');\r\n\t\t\t\t\t\t$currentSelectedDay = '<td id=\"'.$CellID.'\" class=\"'.$this->selectedDateStyle.'\"><a id=\"'.$LinkID.'\" class=\"'.$this->selectedDateStyle.'\"';\r\n\t\t\t\t\t\t$CurrentDate = isset($_REQUEST[$currentday]) ? $_REQUEST[$currentday]: '';\r\n\r\n\t\t\t\t\t\tif ($CurrentDate == $dDay)\t$this->output.= $currentSelectedDay;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$this->output.='<td id=\"'.$CellID.'\" class=';\r\n\t\t\t\t\t\t\t$this->output.= ($dDay==date(\"j\") && $this->year==date(\"Y\") && $this->month==date(\"n\")) ?\r\n\t\t\t\t\t\t\t\t'\"'.$this->currentDateStyle.'\"><a id=\"'.$LinkID.'\" class=\"'.$this->currentDateStyle.'\"' :\r\n\t\t\t\t\t\t\t\t'\"'.$norm_style.'\"><a id=\"'.$LinkID.'\" class=\"'.$this->normalDateStyle.'\"';\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif($this->isDayAvailable($dDay))\r\n\t\t\t\t\t\t\t$this->output.= 'href=\"'.$this->redirect.'?'.$this->add_params_day().'&'.$currentday.'='.$dDay.$this->url_params($currentday,array_keys($this->add_params_day)).'\">'.$dDay.'</a></td>';\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t$this->output.= '>'.$dDay.'</a></td>';\r\n\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$this->output.='<td id=\"'.$CellID.'\" class=\"'.$this->normalDateStyle.'\"></td>'.\"\\n\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$this->output.=\"</tr>\";\r\n \t}\r\n\r\n\t\t$this->output.= '</table>';\r\n\r\n\t\treturn $this->output;\r\n\t}", "public function buildCalendar(){\n\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'calendar';\n\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\">\n <?php echo $this->buildCalendarHead() ?>\n <tr id=\"events_calendar_weekdays\">\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Sunday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Sun</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">S</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Monday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Mon</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">M</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Tuesday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Tue</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">T</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Wednesday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Wed</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">W</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Thursday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Thu</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">T</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Friday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Fri</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">F</div>\n </th>\n <th>\n\t\t\t\t\t<div class=\"full_week_name\">Saturday</div>\n\t\t\t\t\t<div class=\"short_week_name\">Sat</div>\n\t\t\t\t\t<div class=\"abrev_week_name\">S</div>\n </th>\n </tr>\n <?php\n $dayCounter = 0;\t\t\t\t\t\t\t\t\t\t\t//Keeps count of the days in a week\n\n /*** PREVIOUS MONTH CELLS ***/\n for($day = $number_of_previous_days; $day >= 1; $day--){\t//For each day in the previous month needed for a full week\n $dayNumber = $prev_month_number_of_days - ($day-1);\t\t\n \n //Get full date (YYYY-MM-DD)\n $year = ($this->getPrevMonth() == 12)? ($this->getYear()-1): $this->getYear();\n $full_date = $year . '-' . $this->getPrevMonth() . '-' . $dayNumber;\n \n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n \n echo $this->buildCalendarCell($full_date, $dayNumber, 'prev_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n\n /*** CURRENT MONTH CELLS ***/\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n\n echo $this->buildCalendarCell($full_date, $day, 'current_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n\n /*** NEXT MONTH CELLS ***/\n for($day = 1; $day <= $dayCounter; $day++){\t//For each day in the current month\n //Get full date (YYYY-MM-DD)\n $year = ($this->getNextMonth() == 1)? ($this->getYear()+1): $this->getYear();\n $full_date = $year . '-' . $this->getNextMonth() . '-' . $day;\n \n $dayCounter ++;\n if($dayCounter == 1){\t\t\t\t\t//Start new row\n echo '<tr>';\n }\n\n echo $this->buildCalendarCell($full_date, $day, 'next_month');\t//Create Calendar Cell\n\n if($dayCounter == 7){\t\t\t\t\t//End new row\n echo '</tr>';\n $dayCounter = 0;\n }\n }\n ?>\n </table>\n <style>\n\t\t\t<?php \n\t\t\tforeach($this->getCategories() as $c){?>\n\t\t\t#events_calendar .event.category_<?php echo $c->getId(); ?>:before{color: <?php echo $c->getColor(); ?> !important;}\n\t\t\t<?php } ?>\n\t\t</style>\n <?php\n\t\treturn ob_get_clean();\n\t}", "function draw_calendar($month,$year,$activityStartDateArray = array()){\r\n\r\n\t/* draw table */\r\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\r\n\r\n\t/* table headings */\r\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\r\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\r\n\r\n\t/* days and weeks vars now ... */\r\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\r\n\t$days_in_this_week = 1;\r\n\t$day_counter = 0;\r\n\t$dates_array = array();\r\n\r\n\t/* row for week one */\r\n\t$calendar.= '<tr class=\"calendar-row\">';\r\n\r\n\t/* print \"blank\" days until the first of the current week */\r\n\tfor($x = 0; $x < $running_day; $x++):\r\n\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\t$days_in_this_week++;\r\n\tendfor;\r\n\r\n\t/* keep going with days.... */\r\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\r\n\t\t$calendar.= '<td class=\"calendar-day\"><div style=\"position:relative;height:100px;\">';\r\n\t\t\t/* add in the day number */\r\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\r\n\t\t\t\r\n\t\t\t//eventdate=startdate and enddate, depends which we talks about \r\n\r\n\t\t\t$startDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\t//$endDate = $year.'-'.$month.'-'.$list_day;\r\n\t\t\techo \"<br>the start date is\".$startDate;\r\n\t\t\t//something is wrong wit hteh startDate, the origin code has a while loop in the beginning, think why \r\n\t\t\t\r\n\t\t\tif(isset($activityStartDateArray[$startDate])) {\r\n\t\t\t\tforeach($activityStartDateArray[$startDate] as $activity) {\r\n\t\t\t\t\t$calendar.= '<div class=\"activity\">'.$activity['activityName'].'</div>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\telse {\r\n\t\t\t\t$calendar.= str_repeat('<p>&nbsp;</p>',2);\r\n\t\t\t}\r\n\t\t$calendar.= '</div></td>';\r\n\t\tif($running_day == 6):\r\n\t\t\t$calendar.= '</tr>';\r\n\t\t\tif(($day_counter+1) != $days_in_month):\r\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\r\n\t\t\tendif;\r\n\t\t\t$running_day = -1;\r\n\t\t\t$days_in_this_week = 0;\r\n\t\tendif;\r\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\r\n\tendfor;\r\n\t\r\n\t\r\n\t/* finish the rest of the days in the week */\r\n\tif($days_in_this_week < 8):\r\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\r\n\t\t\t$calendar.= '<td class=\"calendar-day-np\">&nbsp;</td>';\r\n\t\tendfor;\r\n\tendif;\r\n\r\n\t/* final row */\r\n\t$calendar.= '</tr>';\r\n\t\r\n\r\n\t/* end the table */\r\n\t$calendar.= '</table>';\r\n\r\n\t/** DEBUG **/\r\n\t$calendar = str_replace('</td>','</td>'.\"\\n\",$calendar);\r\n\t$calendar = str_replace('</tr>','</tr>'.\"\\n\",$calendar);\r\n\t\r\n\t/* all done, return result */\r\n\treturn $calendar;\r\n}", "function draw_calendar(){\r\n \r\n $year = date(\"Y\");\r\n $monthCurrent = date(\"m\");\r\n $monthNext1 = date(\"m\", strtotime('+1 month'));\r\n $monthNext2 = date(\"m\", strtotime('+2 month'));\r\n $monthNext3 = date(\"m\", strtotime('+3 month'));\r\n $monthNext4 = date(\"m\", strtotime('+4 month'));\r\n $monthNext5 = date(\"m\", strtotime('+5 month'));\r\n\r\n $monthCurrentStr = date(\"M\");\r\n $monthNext1Str = date(\"M\", strtotime('+1 month'));\r\n $monthNext2Str = date(\"M\", strtotime('+2 month'));\r\n $monthNext3Str = date(\"M\", strtotime('+3 month'));\r\n $monthNext4Str = date(\"M\", strtotime('+4 month'));\r\n $monthNext5Str = date(\"M\", strtotime('+5 month'));\r\n\r\n\r\n $numberofday1 = cal_days_in_month(CAL_GREGORIAN,$monthCurrent , $year);\r\n $numberofday2 = cal_days_in_month(CAL_GREGORIAN,$monthNext1 , $year);\r\n $numberofday3 = cal_days_in_month(CAL_GREGORIAN,$monthNext2 , $year);\r\n $numberofday4 = cal_days_in_month(CAL_GREGORIAN,$monthNext3 , $year);\r\n $numberofday5 = cal_days_in_month(CAL_GREGORIAN,$monthNext4 , $year);\r\n $numberofday6 = cal_days_in_month(CAL_GREGORIAN,$monthNext5 , $year);\r\n\r\n \r\n\t/* draw table */\r\n $calendar = '<table cellpadding=\"0\" cellspacing=\"2\" style=\"width:100%;\" class=\"calendar\"><thead>';\r\n $calendar.= '<tr>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthCurrentStr.'</center> </th>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthNext1Str.'</center> </th>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthNext2Str.'</center> </th>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthNext3Str.'</center> </th>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthNext4Str.'</center> </th>';\r\n $calendar.= '<th colspan=\"3\"> <center>'.$monthNext5Str.'</center> </th>';\r\n \r\n \r\n\r\n\t\r\n\t/* final row */\r\n $calendar.= '</tr></head>'; \r\n $calendar.= '<tbody><tr>';\r\n // for($i = 1 ,$j = 1 ,$k = 1 ; $i <= $numberofday1, $j = $numberofday2, $k <= $numberofday3 ; $i++, $j++, $k++)\r\n $i = 0 ;\r\n $j = 0;\r\n $k = 0;\r\n $i1 = 0 ;\r\n $j1 = 0;\r\n $k1 = 0;\r\n $u = 0;\r\n\r\n \r\n while( $i <= $numberofday1 || $j <= $numberofday2 || $k <= $numberofday3 || $i1 <= $numberofday4 || $j1 <= $numberofday5 || $k1 <= $numberofday6 )\r\n { $i++;\r\n $j++;\r\n $k++;\r\n $i1++;\r\n $j1++;\r\n $k1++;\r\n $myDay = 0;\r\n $u=0;\r\n if($i <= $numberofday1 ){\r\n\r\n //Verification des jours feries\r\n\r\n $todayCheckHoliday1 = mktime(0, 0, 0, $monthCurrent, $i, $year); \r\n $today1 = unixtojd(mktime(0, 0, 0, $monthCurrent, $i, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n //$todayCheckHoliday = new DateTime($year.'-'.$monthCurrent.'-'.$i.' 00:00:00');\r\n // echo $holidays[1];\r\n // echo $todayCheckHoliday;\r\n \r\n \r\n //////////////////////////////////////////////////\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")){ $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n $calendar.= '<td class=\"small\" > '.$i.' </td>';\r\n $calendar.= '<td class=\"small\" > '.$today[\"abbrevdayname\"].' </td>'; \r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthCurrent.'-'.$i.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthCurrent.'-'.$i.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthCurrent.'-'.$i.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n\r\n else{\r\n\r\n $calendar.= '<td class=\"small\" style=\"background-color:'.$color.'\" ></td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"> </td>';\r\n }\r\n\r\n if($j <= $numberofday2 ){\r\n\r\n $todayCheckHoliday1 = mktime(0, 0, 0, $monthNext1, $j, $year);\r\n $todayCheckHoliday = new DateTime($year.'-'.$monthNext1.'-'.$j.' 00:00:00');\r\n\r\n $today1 = unixtojd(mktime(0, 0, 0, $monthNext1,$j, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")){ $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > '.$j.' </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> '.$today[\"abbrevdayname\"].' </td>';\r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthNext1.'-'.$j.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext1.'-'.$j.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-1\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext1.'-'.$j.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n else{\r\n\r\n $calendar.= '<td class=\"small\" style=\"background-color:\" ></td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"> </td>';\r\n }\r\n if($k <= $numberofday3 ){\r\n\r\n $today1 = unixtojd(mktime(0, 0, 0,$monthNext2, $k, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")) { $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > '.$k.' </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> '.$today[\"abbrevdayname\"].' </td>';\r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthNext2.'-'.$k.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext2.'-'.$k.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-1\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext2.'-'.$k.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n else{\r\n $calendar.= '<td class=\"small\" style=\"background-color:#d1d2d3\" ></td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"></td>';\r\n }\r\n if($i1 <= $numberofday4 ){\r\n\r\n $today1 = unixtojd(mktime(0, 0, 0,$monthNext3, $i1, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")){ $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > '.$i1.' </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> '.$today[\"abbrevdayname\"].' </td>'; \r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthNext3.'-'.$i1.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext3.'-'.$i1.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-1\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext3.'-'.$i1.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n else{\r\n $calendar.= '<td class=\"small\" style=\"\" > </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"> </td>';\r\n }\r\n if($j1 <= $numberofday5 ){\r\n\r\n $today1 = unixtojd(mktime(0, 0, 0,$monthNext4, $j1, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")){ $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > '.$j1.' </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> '.$today[\"abbrevdayname\"].' </td>';\r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthNext4.'-'.$j1.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext4.'-'.$j1.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-1\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext4.'-'.$j1.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n else{\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"> </td>';\r\n }\r\n if($k1 <= $numberofday6 ){\r\n\r\n $today1 = unixtojd(mktime(0, 0, 0,$monthNext5, $k1, $year));\r\n $today = cal_from_jd($today1, CAL_GREGORIAN);\r\n\r\n if(($today[\"abbrevdayname\"] == \"Sun\") || ($today[\"abbrevdayname\"] == \"Sat\")){ $color = \"gray\";}\r\n else {$color = \"\";}\r\n\r\n $calendar.= '<td class=\"small\" style=\"\" > '.$k1.' </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> '.$today[\"abbrevdayname\"].' </td>';\r\n $calendar.= '<td class=\"caseBloque\" id=\"'.$year.'-'.$monthNext5.'-'.$k1.'\" style=\"background-color:'.$color.'\" onclick=\"myEvent(this)\">';\r\n $calendar.= '<div class=\"row\"><div class=\"col-sm-2\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext5.'-'.$k1.':1\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-1\"></div>';\r\n $calendar.= '<div id=\"'.$year.'-'.$monthNext5.'-'.$k1.':2\" class=\"col-sm-3\" onclick=\"getVacation(this)\"></div>';\r\n $calendar.= '<div class=\"col-sm-2\"></div></div></td>';\r\n \r\n }\r\n else{\r\n \r\n $calendar.= '<td class=\"small\" style=\"background-color:'.$color.'\" > </td>';\r\n $calendar.= '<td class=\"small\" style=\"\"> </td>';\r\n $calendar.= '<td style=\"\"> </td>';\r\n }\r\n\r\n \r\n\r\n \r\n $calendar.= '</tr>';\r\n }\r\n \r\n\r\n \r\n\t\r\n\t/* final row */\r\n $calendar.= '</tr>';\r\n \r\n\r\n\r\n\t/* end the table */\r\n\t$calendar.= '</tbody></table>';\r\n\t\r\n\t/* all done, return result */\r\n\treturn $calendar;\r\n}", "function draw_calendar($month,$year){\n\n\t\t/* draw table */\n\t\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t\t/* table headings */\n\t\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t\t/* days and weeks vars now ... */\n\t\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t\t$days_in_this_week = 1;\n\t\t$day_counter = 0;\n\t\t$dates_array = array();\n\n\t\t/* row for week one */\n\t\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t\t/* print \"blank\" days until the first of the current week */\n\t\tfor($x = 0; $x < $running_day; $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t\t$days_in_this_week++;\n\t\tendfor;\n\n\t\t/* keep going with days.... */\n\t\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t\t$calendar.= '<td class=\"calendar-day\"><a href=\"appointments.php?day=' . $list_day . '&month=' . $GLOBALS['curMonth'] . '&year=' . $GLOBALS['curYear'] . '\">';\n\t\t\t\t/* add in the day number */\n\t\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n\n\t\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t\t$calendar.= str_repeat('<p> </p>',2);\n\t\t\t\t\n\t\t\t$calendar.= '</a></td>';\n\t\t\tif($running_day == 6):\n\t\t\t\t$calendar.= '</tr>';\n\t\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\t\tendif;\n\t\t\t\t$running_day = -1;\n\t\t\t\t$days_in_this_week = 0;\n\t\t\tendif;\n\t\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\t\tendfor;\n\n\t\t/* finish the rest of the days in the week */\n\t\tif($days_in_this_week < 8):\n\t\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t\tendfor;\n\t\tendif;\n\n\t\t/* final row */\n\t\t$calendar.= '</tr>';\n\n\t\t/* end the table */\n\t\t$calendar.= '</table>';\n\t\t\n\t\t/* all done, return result */\n\t\treturn $calendar;\n\t}", "function draw_calendar($month,$year, $userID, $type, $dbhandle){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');\n\t$calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\t\t$calendar.= '<td class=\"calendar-day\">';\n\t\t\n\t\t\t//Alert count for this day\n\t\t\t$dateString = '20'.$year.'-'.$month.'-';\n\t\t\tif( $list_day < 10 )\n\t\t\t\t$dateString .= \"0\".$list_day;\n\t\t\telse\n\t\t\t\t$dateString .= $list_day;\n\t\t\t\t\n\t\t\t\n\t\t\t$alertSql = \"select `Date`, Description from Alerts where SubjectID=$userID and Seen=0 and CAST(`Date` AS DATE)='\".$dateString.\"';\";\n\t\t\t$alertResult = $dbhandle->query($alertSql);\n\t\t\t$alertCount = $alertResult->num_rows;\n\t\t\tif( $alertCount > 0 )\n\t\t\t{\n\t\t\t\t$calendar.= '<div><b><a href=\"../Main/Alerts.php?user='.$userID.'&date='.$dateString.'\" style=\"color:red\">'.$alertCount.'</a></b></div>';\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t/* add in the day number */\n\t\t\t$calendar.= '<div class=\"day-number\">'.$list_day.' </div>';\n\t\t\t\n\t\t\t$dayStr = \"\";\n\t\t\tif($type == \"Session\")\n\t\t\t{\n\t\t\t\t$dayAfter = $list_day+1;\n\t\t\t\t$startTime = \"$year-$month-$list_day\";//date(\"Y-m-d\n\t\t\t\t$endtTime = \"\";\n\t\t\t\t//Deal with days/months carrying over\n\t\t\t\tif( $dayAfter > $days_in_month )\t//Check that the day after wont be more than there is in the month\n\t\t\t\t{\n\t\t\t\t\tif( $month == 12 )\n\t\t\t\t\t\t$endtTime = ($year+1) .\"-01-01\";\n\t\t\t\t\telse\n\t\t\t\t\t\t$endtTime = \"$year-\". ($month+1) .\"-01\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$endtTime = \"$year-$month-$dayAfter\";\n\t\t\t\t}\n\t\t\t\t//$calendar.= '<div>'.$endtTime.'</div>';\n\t\t\t\t\t\n\t\t\t\t$sql = \"SELECT SessionID, WingmanPlayed, CyclingPlayed, TargetsPlayed, DATE_FORMAT(StartTime,'%H:%i') as Start, DATE_FORMAT(EndTime,'%H:%i') as End FROM Session WHERE UserID = $userID AND (StartTime > '$startTime' AND EndTime < '$endtTime' AND EndTime <> 0 )\";\n\t\t\t\t$result = $dbhandle->query($sql);\n\t\t\t\tif ($result->num_rows > 0) {\n\t\t\t\t\t// output data of each row\n\t\t\t\t\twhile($row = $result->fetch_assoc()) {\n\t\t\t\t\t\t$sess = $row[\"SessionID\"];\n\t\t\t\t\t\t$start = $row[\"Start\"];\n\t\t\t\t\t\t$end = $row[\"End\"];\n\t\t\t\t\t\tif($dayStr != \"\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$dayStr .= \"<br />\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ($row['WingmanPlayed'] > 0 && $row['TargetsPlayed'] > 0 )\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:red'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Wingman (Elbow Raise) & Targets (Arm Extension)'>$start-$end</a>\";\n }\n \n else if ($row['TargetsPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:green'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Targets (Arm Extension)'>$start-$end</a>\";\n }\n else if ($row['WingmanPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:blue'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Wingman (Elbow Raise)'>$start-$end</a>\";\n } \n\t\t\t\t\t\t\t\t\t\t\t\t\t else if ($row['CyclingPlayed'] > 0)\n {\n $dayStr .= \"<a style='font-size:16px;padding-bottom:2px;color:purple'href='Session.php?SessionID=$sess' 'data-toggle='tooltip' title='S#$sess: Cycling (Elbow Raise)'>$start-$end</a>\";\n } \n\t\t\t\t\t\telse\n {\n \n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t$calendar.= \"<p>$dayStr</p>\";\n\t\t\t\n\t\t$calendar.= '</td>';\n\t\tif($running_day == 6):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\tendif;\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\tendfor;\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\t\n\t/* all done, return result */\n\treturn $calendar;\n}", "public function getCalendar() {\n\t\t$this->setDate();\n\t\t$this->getLinks();\n\t\t $this->di->logger->stamp(__CLASS__, __METHOD__, '');\n\n\n\t\t// Get new date array\n\t\t$newDate = getdate(mktime(0,0,0,$this->newMonth, 1, $this->newYear));\n\t\t// Calculate rest days in previous and next month\n\t\t$firstDay = $newDate['wday'];\n\t\t$firstDay = ($firstDay == 0) ? 7: $firstDay;\n\t\t$daysInMonth = cal_days_in_month ( CAL_GREGORIAN , $this->newMonth , $this->newYear );\n\t\tif($this->newMonth != 1){\n\t\t\t$daysInPrevMonth = cal_days_in_month ( CAL_GREGORIAN , $this->newMonth-1 , $this->newYear );\n\t\t}\n\t\telse if($this->newMonth == 1) {\n\t\t\t$daysInPrevMonth = cal_days_in_month ( CAL_GREGORIAN , 12 , $this->newYear-1 );\n\t\t}\n\n\t\t$lastDates = $daysInPrevMonth - $firstDay +1;\n\n\t\t// Start building table\n\t\t$table =\"<section class='calendar'><header>\" . $this->prevLink . \"<h3>\" . $newDate['month'] . \" - \" . $newDate['year'] . \"</h3>\" . $this->nextLink;\n\t\t$table .= \"</header><table><thead>\\n\";\n\t\t$table .= \"<th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th>\\n\";\n\t\t$table .= \"</thead>\\n\";\n\t\t$table .= \"<tr>\";\n\t\t\n\t\tfor ($a=1; $a < $firstDay ; $a++) { \n\t\t\t$lastDates++;\n\t\t\t$table .= \"<td class='lighter'>\" . $lastDates . \"</td>\";\n\t\t}\n\n\t\t$d = 0;\n\t\tfor ($b=0; $b < $daysInMonth ; $b++) { \n\t\t\t\n\t\t\t$d++;\n\t\t\t$DATE = date('N',mktime(0,0,0, $this->newMonth, $d, $this->newYear));\n\t\t\t\n\t\t\tif ($DATE == 1) {\n\t\t\t\t$table .= \"</tr>\\n<tr>\";\n\t\t\t}\n\n\t\t\tif (($this->newMonth == $this->currentMonth && $d == $this->currentDate && $this->newYear == $this->currentYear)) {\n\t\t\t\t$table .= \"<td><strong>\" . $d . \"</strong></td>\";\n\t\t\t}\n\t\t\telse if ($DATE == 7) {\n\t\t\t\t$table .= \"<td class='red'>\" . $d . \"</td>\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$table .= \"<td>\" . $d . \"</td>\";\n\t\t\t}\n\t\t}\n\t\t\tif ($DATE != 7) {\n\t\t\t\t$nextMonthDays = 7 - $DATE;\n\t\t\t\tfor ($c=1; $c <= $nextMonthDays ; $c++) { \n\t\t\t\t\t$table .= \"<td class='lighter'>\" . $c . \"</td>\";\n\t\t\t}\n\t}\n\t\t$table .= \"</tr></table></section>\";\n\n\t\treturn $table;\n\t}", "function drawCalendar($month, $year) {\n $first = mktime(0,0,0,$month,1,$year); // timestamp for first of the month\n $offset = date('w', $first); // what day of the week we start counting on\n $daysInMonth = date('t', $first);\n $monthName = date('F', $first);\n $weekDays = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');\n $eventDays = getEventDays($month, $year);\n \n // Start drawing calendar\n $out = \"<table id=\\\"myCalendar\\\">\\n\";\n $out .= \"<tr><th colspan=\\\"3\\\">$monthName $year</th></tr>\\n\";\n $out .= \"<tr>\";\n foreach ($weekDays as $wd) $out .= \"<td class=\\\"weekDays\\\">$wd</td>\\n\";\n\n\n // Previous month link\n $prevTS = strtotime(\"$year-$month-01 -1 month\"); // timestamp of the first of last month\n $pMax = date('t', $prevTS);\n $pDay = ($day > $pMax) ? $pMax : $day;\n list($y, $m) = explode('-', date('Y-m', $prevTS)); \n $pMax = date('t', $prevTS);\n $pDay = ($day > $pMax) ? $pMax : $day;\n list($y, $m) = explode('-', date('Y-m', $prevTS));\n echo \"<p>\";\n echo \"<a href=\\\"?year=$year&month=$m&day=$pDay\\\"><< Prev</a>\\n\";\n\n // Next month link\n $nextTS = strtotime(\"$year-$month-01 +1 month\");\n $nMax = date('t', $nextTS);\n $nDay = ($day > $nMax) ? $nMax : $day;\n list($y, $m) = explode('-', date('Y-m', $nextTS));\n echo \"<a href=\\\"?year=$y&month=$m&day=$nDay\\\">Next >></a>\\n\";\n echo \"</p>\";\n\n\n // Build Previous and Next Links from untitled-6\n //$previous_link = \"<a href=\\\"\".$_SERVER['PHP_SELF'].\"?date=\";\n //if($month == 1){\n // $previous_link .= mktime(0,0,0,12,$day,($year -1));\n //} else {\n // $previous_link .= mktime(0,0,0,($month -1),$day,$year);\n //}\n\n //$previous_link .= \"\\\"><< </a>\";\n\n //$next_link = \"<a href=\\\"\".$_SERVER['PHP_SELF'].\"?date=\";\n //if($month == 12){\n // $next_link .= mktime(0,0,0,1,$day,($year + 1));\n //} else {\n // $next_link .= mktime(0,0,0,($month +1),$day,$year);\n //}\n //$next_link .= \"\\\"> >></a>\";\n\n $i = 0;\n for ($d = (1 - $offset); $d <= $daysInMonth; $d++) {\n if ($i % 7 == 0) $out .= \"<tr>\\n\"; // Start new row\n if ($d < 1) $out .= \"<td class=\\\"nonMonthDay\\\"> </td>\\n\";\n else {\n if (in_array($d, $eventDays)) {\n $out .= \"<td class=\\\"monthDay\\\">\\n\";\n $out .= \"<a href=\\\"?year=$year&month=$month&day=$d\\\">$d</a>\\n\";\n $out .= \"</td>\\n\";\n } else $out .= \"<td class=\\\"monthDay\\\">$d</td>\\n\";\n }\n ++$i; // Increment position counter\n if ($i % 7 == 0) $out .= \"</tr>\\n\"; // End row on the 7th day\n }\n \n // Round out last row if we don't have a full week\n if ($i % 7 != 0) {\n for ($j = 0; $j < (7 - ($i % 7)); $j++) {\n $out .= \"<td class=\\\"nonMonthDay\\\"> </td>\\n\";\n }\n $out .= \"</tr>\\n\";\n }\n \n $out .= \"</table>\\n\";\n \n return $out;\n }", "function draw_calendar_activ($month,$year){\n\n\t/* draw table */\n\t$calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n\t/* table headings */\n\t$headings = array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');\n\t$calendar.= '<tr class=\"calendar-row-day\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n\t/* days and weeks vars now ... */\n\t$running_day = date('w',mktime(0,0,0,$month,1,$year));\n\t$days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n\t$days_in_this_week = 1;\n\t$day_counter = 0;\n\t$dates_array = array();\n\n\t/* row for week one */\n\t$calendar.= '<tr class=\"calendar-row\">';\n\n\t/* print \"blank\" days until the first of the current week */\n\tfor($x = 0; $x < $running_day; $x++):\n\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\t$days_in_this_week++;\n\tendfor;\n\n\t/* keep going with days.... */\n\tfor($list_day = 1; $list_day <= $days_in_month; $list_day++){\n\t\t$calendar.= '<td class=\"calendar-day\">';\n\t\t\t/* add in the day number */\n $ddate = $year.\"-\".$month.\"-\".sprintf(\"%02d\", $list_day);\n $newdatabal = sprintf(\"%02d\", $list_day);\n $qq = mysql_query(\"SELECT * FROM reserver WHERE date_deb LIKE('$ddate%')\")or die(mysql_error());\n\n if(mysql_num_rows($qq) >0){\n $newblabla = $ddate.\"<br>\n <a href='afres.php?y=\".$year.\"&m=\".$month.\"&d=\".$newdatabal.\"' target='_blank' style='color: #302C87; text-decoration: none'> Il y'a : \".mysql_num_rows($qq).' reservation(s)</a>';\n }else{\n $newblabla = $ddate.\"<br>no reservations\";\n }\n\t\t\t$calendar.= '<div class=\"day-number\">\n\n '.$newblabla;\n\n\t\t\t/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n\t\t\t$calendar.= str_repeat('<p> </p>',2);\n\n\t\t$calendar.= '</td>';\n\t\tif($running_day == 6):\n\t\t\t$calendar.= '</tr>';\n\t\t\tif(($day_counter+1) != $days_in_month):\n\t\t\t\t$calendar.= '<tr class=\"calendar-row\">';\n\t\t\tendif;\n\t\t\t$running_day = -1;\n\t\t\t$days_in_this_week = 0;\n\t\tendif;\n\t\t$days_in_this_week++; $running_day++; $day_counter++;\n\n\n\t}\n\n\t/* finish the rest of the days in the week */\n\tif($days_in_this_week < 8):\n\t\tfor($x = 1; $x <= (8 - $days_in_this_week); $x++):\n\t\t\t$calendar.= '<td class=\"calendar-day-np\"> </td>';\n\t\tendfor;\n\tendif;\n\n\t/* final row */\n\t$calendar.= '</tr>';\n\n\t/* end the table */\n\t$calendar.= '</table>';\n\n\t/* all done, return result */\n\treturn $calendar;\n\n\n}", "function draw_calendar($year)\n {\n $calendar.= '<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\">\n <title>Calendar</title>\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n <style>\n #today {\n background-color: lightgreen;\n }\n .day-number {\n text-align: center;\n }\n .calendar-week {\n width: 14%;\n text-align: center;\n }\n .container {\n text-align: center;\n }\n .col-centered{\n float: none;\n margin: 0 auto;\n }\n </style>\n </head>\n <body>';\n date_default_timezone_set(\"America/New_York\");\n $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');\n for ($month = 1; $month <= 12; $month++)\n {\n //create header\n $header = '<h2>'.$months[$month-1].' '.$year.'</h2>';\n $calendar.= '<div class=\"row\"><div class=\"container col-xs-6 col-centered\"> <table class=\"table table-bordered\">';\n \n \t// write calendar table headings \n \t$headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');\n \t$calendar.= $header.'<tr><td class=\"calendar-week\">'.implode('</td><td class=\"calendar-week\">',$headings).'</td></tr>';\n \n \t$starting_day = date('w', mktime(0, 0, 0, $month, 1, $year)); //the starting day of the week\n \t$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));\n \t$days_this_week = 1;\n \t$day_counter = 0;\n \t$end_of_month = 0;\n \n \t// row for week one \n \t$calendar.= '<tr>';\n \t\n \t// display blank days until starting day of the current week\n \tfor($day = 0; $day < $starting_day; $day++):\n \t\t$calendar.= '<td> </td>';\n \t\t$days_this_week++; //add blank day to days\n \tendfor;\n \n \t// write days\n \tfor ($day = 1; $day <= $days_in_month; $day++):\n \t\tif ($day != date('d') && $month != date('n'))\n \t\t{\n \t\t\t$current_day = ''; //add blank td per day (that isnt today)\n \t\t}\n \t\t$calendar.= '<td class=\"calendar-day'.$current_day.'\">';\n \t\t\n \t\t\t// Add in the day number\n if ($day == date('d') && $month == date('n') && $year == date('Y')) //this day = today\n \t\t\t{\n \t\t\t\t$showtoday = '<div id=\"today\"> <strong>'.$day.'</strong></div>'; //add today (special styling)\n \t\t\t}else {\n \t\t\t $showtoday = $day;\n \t\t\t}\n \t\t\t$calendar.= '<div class=\"day-number\">'.$showtoday.'</div>'; //commit the date number to the td\n \n \t\t// end of first week\n \t\t$calendar.= '</td>';\n \t\tif($starting_day == 6):\n \t\t\t$calendar.= '</tr>'; // if end of week, end row\n \t\t\tif (($day_counter+1) != $days_in_month) //if today is not end of month, start new row\n \t\t\t{\n \t\t\t\t$calendar.= '<tr>';\n \t\t\t} else \n \t\t\t{\n \t\t\t $end_of_month = 1; // is end of month, so no need for new row\n \t\t\t}\n \t\t\t$starting_day = -1; // if end of week, mark as sunday-1 so when incrementing below, it goes to 0 (sunday)\n \t\t\t$days_this_week = 0; //reset days this week\n \t\tendif;\n \t\t$days_this_week++;\n \t\t$starting_day++;\n \t\t$day_counter++;\n \tendfor;\n \n \t// Finish the rest of blank days in the week\n \tif(($days_this_week < 8) && ($end_of_month == 0)): //last row of calendar, if end of month already has happened (ie on the last day of the previous week), do not add new cells\n \t\tfor($x = 1; $x <= (8 - $days_this_week); $x++):\n \t\t\t$calendar.= '<td> </td>';\n \t\tendfor;\n \tendif;\n \n \t// final row\n \t$calendar.= '</tr>';\n \n \t// end table tags\n \t$calendar.= '</table> </div> </div>';\n }\n // end tags and return\n $calendar.= '</body>\n </html>';\n return $calendar;\n }", "public function buildCalendarList(){\n\t\t\n\t\t$first_day = $this->getFirstDay();\t\t\t\t\t\t//Determine what day of the week the month starts on\n\t\t$current_number_of_days = $this->getNumberOfDays();\t\t//Determine the number of days in the month\n\n\t\t$number_of_previous_days = $first_day;\t\t\t\t\t\t\t\t\t\t//Determine the number of days needed to complete the first week\n\t\t$prev_month_number_of_days = $this->getNumberOfDays($this->getMonth()-1); \t//Determine the number of days in the previous month\n\t\t\n\t\t$_SESSION['month'] = $this->getMonth();\n\t\t$_SESSION['year'] = $this->getYear();\n\t\t$_SESSION['view'] = 'list';\n\t\t\n\t\tob_start();?>\n <table border=\"0\" id=\"events_calendar\" class=\"calendar_list\">\n <?php echo $this->buildCalendarHead() ?>\n <tr>\n <td>\n <?php \n /*** CURRENT MONTH CELLS ***/\n $first_day = $this->getYear() . '-' . $this->getMonth() . '-01';\n $last_day = $this->getYear() . '-' . $this->getMonth() . '-' . $current_number_of_days;\n \n $object = $this->events_ob;\n $month_events = new $object();\n $month_events = $month_events->fetchAll(\"WHERE DATE(\" . $this->events_end_date_field . \") >= '\" . $first_day . \"' AND DATE(\" . $this->events_end_date_field . \") <= '\" . $last_day . \"'\", \"ORDER BY `\" . $this->events_end_date_field . \"` DESC\");\n \n if(count($month_events) > 0){\n for($day = 1; $day <= $current_number_of_days; $day++){\t\t//For each day in the current month\n $full_date = $this->getYear() . '-' . $this->getMonth() . '-' . $day;\n \n $events = $this->buildDayList($full_date);\t//get events for each day\n if(strlen(trim($events))){\n ?>\n <div class=\"day\">\n <?php echo $events; ?>\n </div>\n <?php\n }\n }\n }\n else{?>\n \t\t<h5><?php echo 'No events in ' . $this->getMonthName() . ' ' . $this->getYear();?></h5>\n <?php\n }\n ?> \n </td>\n </tr>\n </table>\n <?php\n return ob_get_clean();\n\t}", "public function render() {\n Openbizx::$app->getClientProxy()->includeCalendarScripts();\n\n $format = $this->dateFormat ? $this->dateFormat : \"%Y-%m-%d\";\n\n $sHTML = parent::render();\n\n $showTime = 'false';\n //$image = \"<img src=\\\"\".Openbizx::$app->getImageUrl().\"/calendar.gif\\\" border=0 title=\\\"Select date...\\\" align='top' hspace='2'>\";\n $sHTML .= \"<a class=\\\"date_picker\\\" href=\\\"javascript: void(0);\\\" onclick=\\\"return showCalendar('$this->objectName','$format',$showTime,true);\\\"></a>\";\n return $sHTML;\n }", "function draw_calendar($month,$year, $day=1){\n /* draw table */\n $draw_calendar_time_start = microtime(true);\n $get_xml_start_time = microtime(true);\n \n $calendar = '';\n $xml = autoCache(\"get_event_xml\", array());\n\n $after_xml_time_start = microtime(true);\n $classes = array(\n 1 => 'sun',\n 2 => 'mon',\n 3 => 'tue',\n 4 => 'wed',\n 5 => 'thu',\n 6 => 'fri',\n 7 => 'sat',\n );\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n /* row for week one */\n $calendar.= '<ul class=\"calendar-row\">';\n /* print previous month days until the first of the current month */\n for($x = 0; $x < $running_day; $x++) {\n //Go in the past $x many days in the past\n $back = ($running_day - $x);\n $back = '-' . ($back) . ' days';\n $last_month_date = date('j', strtotime($back, strtotime($year . '-' . $month . '-01')));\n $calendar .= '<li class=\"' . $classes[$days_in_this_week] . ' event not-current\"><span>' . $last_month_date . '</span></li>';\n $days_in_this_week++;\n }\n\n $twig = makeTwigEnviron('/code/events/twig');\n $twig->getExtension('Twig_Extension_Core')->setTimezone('America/Chicago');\n $calendar .= $twig->render('calendar_rest.html',array(\n 'running_day' => $running_day,\n 'days_in_month' => $days_in_month,\n 'days_in_this_week' => $days_in_this_week,\n 'day_counter' => $day_counter,\n 'classes' => $classes,\n 'xml' => $xml,\n 'year' => $year,\n 'month' => $month));\n\n /* all done, return result */\n $draw_calendar_time_end = microtime(true);\n\n $draw_calendar_time = $draw_calendar_time_end - $draw_calendar_time_start;\n $after_xml_time = $draw_calendar_time_end - $after_xml_time_start;\n error_log(\"After XML draw_calendar in $after_xml_time seconds\\n\", 3, '/tmp/calendar.log');\n error_log(\"Full draw_calendar in $draw_calendar_time seconds\\n\", 3, '/tmp/calendar.log');\n return $calendar;\n}", "private function makeHTMLIterator()\n\t{\n\t\t$this->weekDayNum = $this->firstDayOfTheMonth+1;\n\t\tfor($this->dayOfMonth; $this->dayOfMonth <= $this->daysInMonth; $this->dayOfMonth++) {\n\t\t\t// Set the default style\n\t\t\t$style = 'class=\"normalDay\"';\n\t\t\t\n\t\t\t// Set the style to a weekend day style\n\t\t\tif(($this->weekDayNum == 8)||($this->weekDayNum == 7)) {\n\t\t\t\t$style = 'class=\"weekendDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// Set the style to a current day style\n\t\t\tif($this->curDay == $this->dayOfMonth) {\n\t\t\t\t$style = 'class=\"currentDay\"';\n\t\t\t}\n\t\t\t\n\t\t\t// If the current day is Sunday, add a new row\n\t\t\tif($this->weekDayNum == 8) {\n\t\t\t\t$this->calWeekDays .= \"\\t</tr>\\n\\t<tr>\\n\";\n\t\t\t\t$this->weekDayNum = 1;\n\t\t\t}\n\n\t\t\t// Draw days\n\t\t\t$this->calWeekDays .= \"\\t\\t<td valign=\\\"top\\\" \".$style.'>'.$this->dayOfMonth;\n\t\t\t\n\t\t\tif($this->addWeekDay) {\n\t\t\t\t$this->calWeekDays .= \"|\".$this->weekDayNum;\n\t\t\t}\n\t\t\t\n\t\t\tif(strlen($this->addEvtDest) > 0) {\n\t\t\t\t$addevtimg = (strlen($this->addEvtImg) > 0 ? '<img src=\"'.$this->addEvtImg.'\" class=\"addevtimg\" />' : '+');\n\t\t\t\t$this->calWeekDays .= '[<a href=\"'.$this->addEvtDest.'?date='.$this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth.'\" title=\"Add Event\" class=\"addevt\">'.$addevtimg.'</a>]';\n\t\t\t}\n\t\t\t\n\t\t\t$this->calWeekDays .= \" \".$this->makeDayEventListHTML().\"</td>\\n\";\n\t\t\t\n\t\t\t$this->weekDayNum++;\n\t\t}\n\t}", "public function buildCalendarHead(){\n\t\tob_start();?>\n \t<tr id=\"view_as\">\n <td colspan=\"7\">\n <?php \n\t\t\t\tif($_SESSION['view'] == 'list'){\n\t\t\t\t\techo '<a class=\"view_as_calendar\"><i class=\"fa fa-calendar\"></i>View as Calendar</a>';\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\techo '<a class=\"view_as_list\"><i class=\"fa fa-list\"></i>View as List</a>';\t\n\t\t\t\t}\n ?>\n </td>\n </tr>\n <tr id=\"calendar_title\">\n <th colspan=\"7\">\n <table width=\"100%\">\n <tr>\n <th class=\"left\">\n <a class=\"prev_month_link large_button btn btn-primary\"><i class=\"fa fa-chevron-left\"></i><?php echo $this->getPrevMonthName(); ?></a>\n <a class=\"prev_month_link small_button btn btn-primary\"><i class=\"fa fa-chevron-left\"></i><br /><?php echo $this->getPrevMonthName(); ?></a>\n </th>\n <th><h2><?php echo $this->getMonthName() . ' ' . $this->getYear();?></h2></th>\n <th class=\"right\">\n <a class=\"next_month_link large_button btn btn-primary\"><?php echo $this->getNextMonthName(); ?><i class=\"fa fa-chevron-right\"></i></a>\n <a class=\"next_month_link small_button btn btn-primary\"><i class=\"fa fa-chevron-right\"></i><br/><?php echo $this->getNextMonthName(); ?></a>\n </th>\n </tr>\n </table>\n </th>\n </tr>\n <tr id=\"calendar_legend\">\n <td colspan=\"7\">\n \t<?php \n\t\t\t\t\t\t$categories = $this->getCategories();\t\t\t\t\t\t\n\t\t\t\t\t\tforeach($categories as $c){ ?>\n\t\t\t\t\t\t\t<span class=\"category-indicator\">\n\t\t\t\t\t\t\t\t<i class=\"fa fa-circle\" style=\"color: <?php echo $c->getColor(); ?>;\"></i>\n\t\t\t\t\t\t\t\t<span class=\"category-name\"><?php echo $c->getName(); ?></span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<?php\n\t\t\t\t\t\t}\n\t\t\t\t\t?>\n </td>\n </tr>\n <?php\n\t\treturn ob_get_clean();\n\t}", "function MakeCalendarGrid(){\n //get our days\n $intMonthDays = cal_days_in_month(CAL_GREGORIAN, $this->intMonth, $this->intYear);\n $intDayCounter = 0;\n $arrMonthAttributes = array('colspan'=>'7');\n //make our parent calendar table\n $objCalendarParent = $this->objCalendar->AddChildNode($this->objCalendar->objHTML,'', 'table');\n //let's make our header\n $objHeaderRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n //establish our base attributes\n for($intWeekDay=0;$intWeekDay<7;$intWeekDay++){\n $strDay = date('l', strtotime(\"Sunday +{$intWeekDay} days\"));\n $this->objCalendar->AddChildNode($objHeaderRow,$strDay, 'th',array('class'=>'weekday'));\n }\n //get the starting date\n $intMonthStart = date('N', strtotime($this->intYear.'-'.$this->intMonth.'-1'));\n $intMonthStart++;\n //avoid empty rows\n if($intMonthStart == 8)\n $intMonthStart = 1;\n //make our days now\n for($intDay=1;$intDay<($intMonthDays + $intMonthStart);$intDay++){\n $arrDateAttributes = array('onclick'=>'SelectDay(this);');\n if($intDayCounter === 0){\n //make our new week\n $objWeekRow = $this->objCalendar->AddChildNode($objCalendarParent,'', 'tr');\n $arrDateAttributes['class'] = 'calendarday weekend';\n }\n else if($intDayCounter === 6)\n $arrDateAttributes['class'] = 'calendarday weekend';\n else if($intDay == date('j'))\n $arrDateAttributes['class'] = 'calendarday today';\n else\n $arrDateAttributes['class'] = 'calendarday weekday';\n $intDayCounter++;\n //reset our week now\n if($intDayCounter == 7)\n $intDayCounter = 0;\n if($intDay < $intMonthStart){\n unset($arrDateAttributes['onclick']);\n $this->objCalendar->AddChildNode($objWeekRow,'&nbsp;', 'td',$arrDateAttributes);\n continue 1;\n }\n $arrDateAttributes['id'] = ($intDay - ($intMonthStart - 1)).'-'.$this->arrCalendarProperties['calendarid'];\n //make our day now\n $this->objCalendar->AddChildNode($objWeekRow,($intDay - ($intMonthStart - 1)), 'td',$arrDateAttributes);\n }\n return TRUE;\n }", "public function drawSpecificItem($item){\r\n \tif (! $this->id) {\r\n \t\t//return;\r\n \t}\r\n $today=date('Y-m-d');\r\n \tglobal $bankHolidays,$bankWorkdays;\r\n //$result=\"<br/>\";\r\n $result=\"\";\r\n if ($item=='calendarView') { \t\r\n if ($this->year) {\r\n $y=$this->year;\r\n } else {\r\n \t$y=date('Y');\r\n }\r\n //echo $y.'#'.$this->idCalendarDefinition;\r\n //if (! isset($bankWorkdays[$y.'#'.$this->idCalendarDefinition])) {return;\t}\r\n if (! $this->idCalendarDefinition) { return;}\r\n $result .='<table >';\r\n $result .='<tr><td class=\"calendarHeader\" colspan=\"32\">' .$y . '</td></tr>';\r\n for ($m=1; $m<=12; $m++) {\r\n \t$mx=($m<10)?'0'.$m:''.$m;\r\n \t$time=mktime(0, 0, 0, $m, 1, $y);\r\n $libMonth=i18n(strftime(\"%B\", $time));\r\n \t$result .= '<tr style=\"height:30px\">';\r\n \t$result .= '<td class=\"calendar\" style=\"background:#F0F0F0; width: 150px;\">' . $libMonth . '</td>';\r\n \tfor ($d=1;$d<=date('t',strtotime($y.'-'.$mx.'-01'));$d++) {\r\n \t\t$dx=($d<10)?'0'.$d:''.$d;\r\n \t\t$day=$y.'-'.$mx.'-'.$dx;\r\n \t\t$iDay=strtotime($day);\r\n \t\t$isOff=isOffDay($day,$this->idCalendarDefinition);\r\n \t\t$style='';\r\n \t\tif ($day==$today) {\r\n \t\t\t$style.='font-weight: bold; font-size: 9pt;';\r\n \t\t}\r\n \t\tif (in_array (date ('Ymd', $iDay), $bankWorkdays[$y.'#'.$this->idCalendarDefinition])) {\r\n \t\t\t$style.='color: #FF0000; background: #FFF0F0;';\r\n \t\t} else if (in_array (date ('Ymd', $iDay), $bankHolidays[$y.'#'.$this->idCalendarDefinition])) {\r\n $style.='color: #0000FF; background: #D0D0FF;';\r\n } else {\r\n $style.='background: ';\r\n \t$style.=($isOff)?'#DDDDDD;':'#FFFFFF;';\r\n }\r\n \t\t$result.= '<td class=\"calendar\" style=\"'.$style.'\">';\r\n \t\t$result.= '<div style=\"cursor: pointer;\" onClick=\"loadContent(\\'../tool/saveCalendar.php?idCalendarDefinition='.$this->idCalendarDefinition.'&day='. $day . '\\',\\'CalendarDefinition_Calendar\\');\">';\r\n \t\t$result.= substr(i18n(date('l',$iDay)),0,1) . $d ;\r\n \t\t$result.= '</div>';\r\n \t\t$result.= '</td>';\r\n \t}\r\n \t$result .= '</tr>';\r\n }\r\n $result .='</table>';\r\n return $result;\r\n }\r\n }", "function draw_calendar($conn, $month,$year,$alat){\n\n /* draw table */\n $calendar = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"calendar\">';\n\n /* table headings */\n $headings = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');\n $calendar.= '<tr class=\"calendar-row\"><td class=\"calendar-day-head\">'.implode('</td><td class=\"calendar-day-head\">',$headings).'</td></tr>';\n\n /* days and weeks vars now ... */\n $running_day = date('w',mktime(0,0,0,$month,1,$year));\n $days_in_month = date('t',mktime(0,0,0,$month,1,$year));\n $days_in_this_week = 1;\n $day_counter = 0;\n\n $booked[] = $days_in_month;\n for($i = 0; $i<=$days_in_month; $i++){\n $booked[$i] = '';\n }\n\n $now = $month + $year *12;\n\n //PENGECEKKAN STATUS UNTUK KEPENTINGAN KALENDER\n //booking\n $result = mysqli_query($conn,\"SELECT * FROM booking NATURAL JOIN alat where nama_alat = '$alat' and ((year(tanggal_rencana_peminjaman)*12 + month(tanggal_rencana_peminjaman)) <= '$now') and ((year(tanggal_rencana_pengembalian)*12 + month(tanggal_rencana_pengembalian)) >= '$now')\");\n if(mysqli_num_rows($result)>0){\n markdate($booked,$result,$days_in_month,$month,2);\n }\n mysqli_free_result($result);\n\n //peminjaman\n $result = mysqli_query($conn,\"SELECT * FROM peminjaman NATURAL JOIN alat where nama_alat = '$alat' and tanggal_pengembalian IS NULL and ((year(tanggal_peminjaman)*12 + month(tanggal_peminjaman)) <= '$now') and ((year(tanggal_rencana_pengembalian)*12 + month(tanggal_rencana_pengembalian)) >= '$now')\");\n if(mysqli_num_rows($result)>0){\n markdate($booked,$result,$days_in_month,$month,1);\n }\n mysqli_free_result($result);\n\n //perbaikan\n $result = mysqli_query($conn,\"SELECT * FROM perbaikan NATURAL JOIN alat where nama_alat = '$alat' and tanggal_selesai_perbaikan IS NULL and ((year(tanggal_mulai_perbaikan)*12 + month(tanggal_mulai_perbaikan)) <= '$now') and ((year(estimasi_selesai_perbaikan)*12 + month(estimasi_selesai_perbaikan)) >= '$now')\");\n if(mysqli_num_rows($result)>0){\n markdate($booked,$result,$days_in_month,$month,3);\n }\n mysqli_free_result($result);\n\n //END OF PENGECEKKAN STATUS\n\n /* row for week one */\n $calendar.= '<tr class=\"calendar-row\">';\n\n /* print \"blank\" days until the first of the current week */\n for($x = 0; $x < $running_day; $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n $days_in_this_week++;\n endfor;\n\n /* keep going with days.... */\n for($list_day = 1; $list_day <= $days_in_month; $list_day++):\n\n $calendar.= '<td class=\"calendar-day\">';\n\n /* add in the day number */\n $calendar.= '<div class=\"day-number\">'.$list_day.'</div>';\n\n /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/\n $calendar.= $booked[$list_day-1];\n\n $calendar.= '</td>';\n if($running_day == 6):\n $calendar.= '</tr>';\n if(($day_counter+1) != $days_in_month):\n $calendar.= '<tr class=\"calendar-row\">';\n endif;\n $running_day = -1;\n $days_in_this_week = 0;\n endif;\n $days_in_this_week++; $running_day++; $day_counter++;\n\n endfor;\n\n /* finish the rest of the days in the week */\n if($days_in_this_week < 8):\n for($x = 1; $x <= (8 - $days_in_this_week); $x++):\n $calendar.= '<td class=\"calendar-day-np\"> </td>';\n endfor;\n endif;\n\n /* final row */\n $calendar.= '</tr>';\n\n /* end the table */\n $calendar.= '</table>';\n\n\n /* all done, return result */\n return $calendar;\n}", "public function generaHtml(){\n\t\t$diaSetmana = DateTime::createFromFormat('d/m/Y', $this->date)->format('l');\n\t\t$this->table = \"<table id='sessions'><thead><tr><th>\" . $diaSetmana . \" \" . $this->date . \"</th></tr></thead>\";\n\t\t\n\t\tforeach($this->sessionsArray as $session):\n\t\t\t$dataHoraInici = $session->getDataHoraInici();\n\t\t\t\n\t\t\t$session_date = date('d/m/Y', strtotime($dataHoraInici));\n\t\t\t\n\t\t\tif($session_date == $this->date) {\n\t\t\t\t$this->haveClassesToday = true;\n\t\t\t\t$hora = explode(\" \", $dataHoraInici);\n\t\t\t\t$this->table .= \"<tr><td>\".$hora[1].\"</td><td>\".$session->getAssignatura()->getNom().\"<br />\".$session->getTipus().\"<br />\".$session->getAula().\"</td></tr>\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$this->logger->debug('Wrong day for session');\n\t\t\t\t$this->logger->debug('session_date is: ' . $session_date . ' specified date is: ' . $this->date);\n\t\t\t}\n\t\tendforeach;\n\t\t\n\t\t$this->table .= \"</table>\";\n\t\t$this->logger->debug(\"Html generated is: \" . $this->table);\n\t}", "public function render()\n {\n $result = array();\n\n if ($this->hasSources())\n {\n $visibleSources = 0;\n\n $result[] = '<div class=\"panel panel-default table-calendar-legend\">';\n $result[] = '<div class=\"panel-heading\">';\n $result[] = '<h4 class=\"panel-title\">' . Translation::get('Legend') . '</h4>';\n $result[] = '</div>';\n $result[] = '<ul class=\"list-group\">';\n\n $sources = $this->getSources();\n\n sort($sources);\n\n foreach ($sources as $source)\n {\n $sourceClasses = $this->getSourceClasses($source);\n\n if ($this->getDataProvider()->supportsVisibility())\n {\n $isSourceVisible = $this->getDataProvider()->isSourceVisible($source);\n $eventClasses = ! $isSourceVisible ? ' event-container-source-faded' : '';\n }\n else\n {\n\n $eventClasses = '';\n }\n\n $result[] = '<li class=\"list-group-item\">';\n $result[] = '<div class=\"event-source' . $eventClasses . '\" data-source-key=\"' .\n $this->addSource($source) . '\" data-source=\"' . $source . '\">';\n $result[] = '<span class=\"event-container ' . $sourceClasses . '\"></span>';\n $result[] = $source;\n $result[] = '</div>';\n $result[] = '</li>';\n\n if ($this->getDataProvider()->supportsVisibility())\n {\n if ($isSourceVisible)\n {\n $visibleSources ++;\n }\n }\n }\n\n $result[] = '</ul>';\n $result[] = '</div>';\n\n if ($this->getDataProvider()->supportsVisibility())\n {\n $result[] = '<script type=\"text/javascript\">';\n $result[] = 'var calendarVisibilityContext = ' .\n json_encode($this->getDataProvider()->getVisibilityContext()) . ';';\n $result[] = '</script>';\n\n $result[] = ResourceManager::getInstance()->get_resource_html(\n Path::getInstance()->getJavascriptPath(__NAMESPACE__, true) . 'Highlight.js');\n\n if ($visibleSources == 0)\n {\n $notificationMessageManager = new NotificationMessageManager();\n $notificationMessageManager->addMessage(\n new NotificationMessage(\n Translation::get('AllEventSourcesHidden'),\n NotificationMessage::TYPE_WARNING));\n }\n }\n }\n\n return implode(PHP_EOL, $result);\n }", "public function render()\n {\n $this->prepareVars();\n return $this->makePartial('calendar');\n }", "public function __toString()\n {\n // Can this set of dates be rendered?\n if (!$this->bOneFullMonth) {\n throw new \\Exception(\n __METHOD__ . ' - Only one full month can be rendered (end date must be \"true\").'\n );\n }\n\n $i = 0;\n $strHtml = '<h3 class=\"sked-cal-title\">' . date('F', strtotime($this->strStart))\n . '</h3><table class=\"sked-cal\"><thead>';\n\n // Day headers\n foreach (SkeVent::WEEKDAYS as $strDay)\n $strHtml .= '<th><center>' . $strDay . '</center></th>';\n\n $strHtml .= '</thead><tr>';\n for ($j = 0; $j < $this->monthPadDates(); $j++) {\n $i++;\n $strHtml .= '<td></td>';\n }\n\n foreach ($this as $skeDate) {\n $i++;\n $strHtml .= '<td class=\"sked-cal-date' . (date('Y-m-d') !== $skeDate->format('Y-m-d') ? '' : ' sked-cal-date-current') . '\">';\n $strHtml .= '<span class=\"sked-cal-date-num\">' . $skeDate->format('j') . '</span>';\n $strHtml .= '<ul class=\"sked-cal-date-list\">';\n foreach ($skeDate->events() as $skeVent) {\n $strHtml .= '<li class=\"sked-cal-date-event\">'\n . '<a href=\"#\" class=\"sked-cal-event-link\" id=\"skevent-'\n . $skeVent->id . '\" data-owner-id=\"' . $skeVent->owner()\n . '\">'\n . $skeVent->label\n . '</a><span>' . $skeVent->time('g:ia', $this->strTimezone) . '</span>'\n . '</li>';\n }\n $strHtml .= '</ul>';\n $strHtml .= '</td>';\n if (7 === $i) {\n $i = 0;\n $strHtml .= '</tr><tr>';\n }\n }\n\n if ($i) {\n for ($j = $i; $j < 7; $j++) {\n $strHtml .= '<td></td>';\n }\n }\n\n return $strHtml . '</tr></table>';\n }", "public function renderHTML() {\r\n\t\t// Mois et année du jour\r\n\t\t$time = time ();\r\n\t\t$mois_actuel = date ( 'm', $time );\r\n\t\t$annee_actuelle = date ( 'Y', $time );\r\n\r\n\t\t$aff = $this->renderstyle ();\r\n\t\t$aff .= '<div id=\"FilAriane\"><a href=\"../../../index.php?menu=4\">Site Emploi</a>&nbsp;>&nbsp;';\r\n\t\t$aff .= '<a href=\"?\">Statistiques Site Emploi</a>&nbsp;>&nbsp;Réponses par région et domaine d\\'activité</div><br />';\r\n\r\n\t\t$aff .= '<table><tr>';\r\n\t\t$aff .= '<td><img width=\"15px\" height=\"15px\" src=\"../../../include/images/export.jpg\" /></td>';\r\n\t\t$aff .= '<td> <a target=\"blank\" href=\"../statistiques/metier/getReponseRegion.php?export=1&m=' . (isset ( $_GET ['m'] ) ? $_GET ['m'] : $mois_actuel) . '&a=' . (isset ( $_GET ['a'] ) ? $_GET ['a'] : $annee_actuelle) . '\"> Exporter les données affichées</a></td>';\r\n\t\t$aff .= '</tr>';\r\n\t\t$aff .= '<tr></table>';\r\n\r\n\t\t// *************************************** Début calendrier ******************************************\r\n\r\n\t\t$aff .= '<div align=\"center\" ><form>';\r\n\t\t// Si on a demandé une date\r\n\t\tif (isset ( $_GET ['m'] ) && isset ( $_GET ['a'] )) {\r\n\t\t\t$aff .= '<a style=\"background-image:url(\\'../../../include/images/3.png\\');\" href=\"?action=rep&m=' . $_GET ['m'] . '&a=' . ($_GET ['a'] - 1);\r\n\t\t\t$aff .= '\">\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><a style=\"background-image:url(\\'../../../include/images/3.png\\');\" href=\"?action=rep&m=';\r\n\t\t\tif ($_GET ['m'] == '01') {\r\n\t\t\t\t$aff .= '12&a=' . ($_GET ['a'] - 1);\r\n\t\t\t} else {\r\n\t\t\t\t$aff .= ($_GET ['m'] - 1) . '&a=' . $_GET ['a'];\r\n\t\t\t}\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';\r\n\t\t\t$aff .= '<select name=\"mois\" onChange=\"window.location=\\'/admin/modules/app-site-emploi/statistiques/index.php?action=rep&m=\\' + this.form.mois.value + \\'&a=' . $_GET ['a'] . '\\'\">';\r\n\t\t\t$i = 1;\r\n\t\t\twhile ( $i <= 12 ) {\r\n\t\t\t\t$aff .= '<option value=\"' . $i . '\" ' . ($_GET ['m'] == $i ? 'selected' : '') . '>' . FunctionDate::getMois ( $i ) . '</option>';\r\n\t\t\t\t$i ++;\r\n\t\t\t}\r\n\t\t\t$aff .= '</select> ';\r\n\t\t\t$aff .= $_GET ['a'] . ' <a style=\"background-image:url(\\'../../../include/images/1.png\\');\" href=\"?action=rep&m=';\r\n\t\t\tif ($_GET ['m'] == '12') {\r\n\t\t\t\t$aff .= '01&a=' . ($_GET ['a'] + 1);\r\n\t\t\t} else {\r\n\t\t\t\t$aff .= ($_GET ['m'] + 1) . '&a=' . $_GET ['a'];\r\n\t\t\t}\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><a style=\"background-image:url(\\'../../../include/images/1.png\\');\" href=\"?action=rep&m=' . $_GET ['m'] . '&a=' . ($_GET ['a'] + 1);\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';\r\n\t\t} // Sinon on prend le moi et l'année actuels\r\n\t\telse {\r\n\t\t\t$aff .= '<a style=\"background-image:url(\\'../../../include/images/3.png\\');\" href=\"?action=rep&m=' . $mois_actuel . '&a=' . ($annee_actuelle - 1);\r\n\t\t\t$aff .= '\">\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><a style=\"background-image:url(\\'../../../include/images/3.png\\');\" href=\"?action=rep&m=';\r\n\t\t\tif ($mois_actuel == '01') {\r\n\t\t\t\t$aff .= '12&a=' . ($annee_actuelle - 1);\r\n\t\t\t} else {\r\n\t\t\t\t$aff .= ($mois_actuel - 1) . '&a=' . $annee_actuelle;\r\n\t\t\t}\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';\r\n\t\t\t$aff .= ' <select name=\"mois\" onChange=\"window.location=\\'/admin/modules/app-site-emploi/statistiques/index.php?action=rep&m=\\' + this.form.mois.value + \\'&a=' . $annee_actuelle . '\\'\">';\r\n\t\t\t$i = 1;\r\n\t\t\twhile ( $i <= 12 ) {\r\n\t\t\t\t$aff .= '<option value=\"' . $i . '\" ' . ($mois_actuel == $i ? 'selected' : '') . '>' . FunctionDate::getMois ( $i ) . '</option>';\r\n\t\t\t\t$i ++;\r\n\t\t\t}\r\n\t\t\t$aff .= '</select> ';\r\n\t\t\t$aff .= $annee_actuelle . '<a style=\"background-image:url(\\'../../../include/images/1.png\\');\" href=\"?action=offre_rep&m=';\r\n\t\t\tif ($mois_actuel == '12') {\r\n\t\t\t\t$aff .= '01&a=' . ($annee_actuelle + 1);\r\n\t\t\t} else {\r\n\t\t\t\t$aff .= ($mois_actuel + 1) . '&a=' . $annee_actuelle;\r\n\t\t\t}\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><a style=\"background-image:url(\\'../../../include/images/1.png\\');\" href=\"?action=rep&m=' . $mois_actuel . '&a=' . ($annee_actuelle + 1);\r\n\t\t\t$aff .= '\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';\r\n\t\t}\r\n\t\t$aff .= '</div></form><br />';\r\n\t\t// *************************************** Fin calendrier ******************************************\r\n\t\t// Création du tableau\r\n\r\n\t\t$aff .= '<table id=\"TableList\" width=\"100%\" class=\"liste\">';\r\n\t\t$aff .= '<tr class=\"title\"><td align=\"center\" ><b>Région</b></td>';\r\n\t\tforeach ( $this->myListedomaine->getList () as $aDA ) {\r\n\t\t\t$aff .= '<td align=\"center\"><b>' . $aDA->getnomdomaine () . '</b></td>';\r\n\t\t}\r\n\t\t$aff .= '<td align=\"center\">Total</td></tr>';\r\n\t\t$row = 1;\r\n\t\tforeach ( $this->myListeregion->getList () as $aRegion ) {\r\n\t\t\tif ($aRegion->getlibelle () == 'Toute la France') {\r\n\t\t\t\t$aff .= '<tr>';\r\n\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\"><b>' . $aRegion->getlibelle () . '</b></td>';\r\n\t\t\t\tforeach ( $this->myListedomaine->getList () as $aDA ) {\r\n\t\t\t\t\t$total_ligne = 0;\r\n\t\t\t\t\t$aStatAll = new StatReponseRegion ();\r\n\t\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\" >' . $aStatAll->SQL_COUNT ( $aDA->getiddomaine () ) . '</td>';\r\n\t\t\t\t\tif (array_key_exists ( $aRegion->getidregion () . '-' . $aDA->getiddomaine (), $this->myaStat )) {\r\n\t\t\t\t\t\t$total_ligne += $this->myaStat [$aRegion->getidregion () . '-' . $aDA->getiddomaine ()];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\">' . $total_ligne . '</td></tr>';\r\n\t\t\t} else \r\n\t\t\t{ // total par ligne\r\n\t\t\t\t$total_ligne = 0;\r\n\t\t\t\t$aff .= '<tr>';\r\n\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\"><b>' . $aRegion->getlibelle () . '</b></td>';\r\n\t\t\t\tforeach ( $this->myListedomaine->getList () as $aDA ) {\r\n\t\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\" >' . (array_key_exists ( $aRegion->getidregion () . '-' . $aDA->getiddomaine (), $this->myaStat ) ? $this->myaStat [$aRegion->getidregion () . '-' . $aDA->getiddomaine ()] : 0) . '</td>';\r\n\t\t\t\t\tif (array_key_exists ( $aRegion->getidregion () . '-' . $aDA->getiddomaine (), $this->myaStat )) {\r\n\t\t\t\t\t\t$total_ligne += $this->myaStat [$aRegion->getidregion () . '-' . $aDA->getiddomaine ()];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\" >' . $total_ligne . '</td>';\r\n\t\t\t}\r\n\t\t\t$row = ($row == 1 ? 2 : 1);\r\n\t\t}\r\n\r\n\t\t// Total par colonne et total général\r\n\t\t$aff .= '<tr><td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\">Total</td>';\r\n\t\t$total = 0;\r\n\t\tforeach ( $this->myListedomaine->getList () as $aDA ) {\r\n\t\t\t$aStatAll = new StatReponseRegion ();\r\n\t\t\t$data = $aStatAll->SQL_COUNT_TOT ( $aDA->getiddomaine (), isset ( $_GET ['m'] ) ? $_GET ['m'] : date ( 'm', $time ), isset ( $_GET ['a'] ) ? $_GET ['a'] : date ( 'Y', $time ) );\r\n\t\t\t$total += $data;\r\n\t\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\"><b>' . $data . '</b></td>';\r\n\t\t}\r\n\t\t$aff .= '<td class=\"' . ($row == 1 ? 'row1' : 'row2') . '\" align=\"center\">' . $total . '</tr></table><br />';\r\n\t\techo $aff;\r\n\t}", "function displayCurrentMonthCalenderAsTable()\n{\nglobal $year; // this year\nglobal $month; // this month\nglobal $id;\n$day=1; // start from first of month\nglobal $crypted;\nglobal $month_caption; // caption to table\n$lastmonth = $month - 1;\n$nextmonth = $month +1;\n$lastyear = $year - 1;\n$nextyear = $year + 1;\necho \"<table summary=\\\"Monthly calendar\\\" onMouseover= changeto('#CCCCCC') onMouseout= changeback('white') width = 757 cellspacing= 2 cellpadding= 2 id= ignore class=\\\"sk_bok_green\\\">\n<caption ><a href=comm.php?crypted=$_GET[crypted]&calender&lastyear=$lastyear ><font color=green>Last Year</font></a>&nbsp;&nbsp;&nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&last=$lastmonth&year=$year><font color=green>Last Month</a>&nbsp;&nbsp;&nbsp; <b>[$month_caption ]</b> &nbsp;&nbsp;&nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&next=$nextmonth&year=$year><font color= green>Next Month</font></a> &nbsp;<a href=comm.php?crypted=$_GET[crypted]&calender&lastyear=$nextyear><font color= green>Next Year<font></a></caption>\n<tr align=center id=ignore>\n<th width =308 id=ignore bgcolor=#FFC56C ><font color =Red>Sun</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Mon</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Tue</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Wed</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Thu</font></th>\n<th width =308 id=ignore bgcolor=#FFC56C><font color =Green>Fri</font></th> \n<th width =308 id=ignore bgcolor=#FFC56C><font color =blue>Sat</font></th> \n</tr>\\n\"; \n\n$ts = mktime(0,0,0,$month,$day,$year); // unix timestamp of the first day of current month\n$weekday_first_day = date(\"w\",$ts); // which is the weekday of the first day of week 0-Sunday 6-Saturday\n//$my_format = date(\"d-m-Y\");\n$slot=0;\n\nprint \"<tr align=center >\\n\"; // First row starts\nfor($i=0;$i<$weekday_first_day;$i++) // Pad the first few rows(slots)\n{\nprint \" <td id=ignore width =308></td>\"; // Empty slots \n$slot++;\n}\n\tif($day == '')\n\t{\n\t\t$ig = 'ignore';\n\t\techo \">>\";\n\t}\n\nwhile(checkdate($month,$day,$year) && $date<32) // till there are valid days in current month\n{\nif($slot == 7) // if we moved past saturday\n{\n$slot = 0; // reset and move back to sunday\nprint \"</tr>\\n\"; // end of this row\nprint \"<tr align=center width =50>\\n\"; // move on to next row\n\n}\n\t//$system_date = '$day-$month-$year';\n\t//$db_date = date('d-m-Y',$day $month $year);\n\t$system_date = mktime(0, 0, 0, $month, $day, $year);\n\t$db_date = date('d-m-Y',$system_date);\n\t$db_date_search = explode('-',$db_date);\n\t//print_r($db_date_search);\n\t$search_date = mktime(0, 0, 0, $month, $day);\n\t$search_date = sprintf(date('d-m-',$search_date));\n\t$month_no = $db_date_search[1];\n\t $query =\"select * from calender_event where active = '1' and day = '$db_date_search[0]' and `month_no` = '$month_no' and year = '$db_date_search[2]' \";\n\t\n\t$result = mysql_query($query) or die(mysql_error());\n\t$count = mysql_num_rows($result);\n\t/* echo $query;\n\techo $count; */\n\t$tr = 0;\n\t\n\tif($count != '0')\n\t{\t$msg .= \"<table id=ignore width=100%>\";\n\t\twhile($row=mysql_fetch_array($result))\n\t\t{\n\t\t\n\t\tif($row[popup] =='1')\n\t\t{\n\t\t\t$popup_link = \" onmouseout=\\\"hideTooltip()\\\" onmouseover=\\\"showTooltip(event,'$row[pop_msg]'\";\n\t\t\n\t\t}else\n\t\t{\n\t\t\t$popup_link =\"\";\n\t\t}\n\t\t\n\t\t$msg .= \"<tr ><td id=ignore bgcolor=green>$row[heading]</td></tr><tr><td id=ignore bgcolor=white><a href=\\\"comm.php?crypted=$_GET[crypted]&last=$month_no&year=$db_date_search[2]&calender&edit_event=$row[sno]\\\" $popup_link);return false\\\">$row[details]</a></td></tr>\";\n\t\t}\n\t\t$msg .= \"</table>\";\n\t}else\n\t{\n\t\t$msg ='';\n\t\n\t}\n\t//chking all db\n\t$color = \"bgcolor = white\";\n\techo \"<td $color id=$idd width =308 hight=308><DIV align=center id= tips><a href = #><font color=black><a href=comm.php?crypted=$_GET[crypted]&last=$month_no&year=$db_date_search[2]&calender&add_event=$db_date_search[0]-$db_date_search[1]-$db_date_search[2]>$day</a> </font>\n\t\t\n\t\t \";\n\t\n\t\n\t\techo \"</div ></a>$msg</div ></td>\";\n$msg ='';\n\t\n\n$day++;\n$slot++;\n}\n\nif($slot>0) // have we started off a new last row \n{\nwhile($slot<7) // padding at the end to complete the last row table\n{\nprint \" <td id=ignore></td>\"; // empty slots\n$slot++;\n}\nprint \"\\n</tr>\\n\"; // close out last row\n}\nprint '</table>'; //end of table\n}", "public function api_getTable($month,$year)\n\t{\n\t\t$employees = Employee::all();\n\n\t\tforeach ($employees as $key => $value) {\n\t\t\t$calendar = Calendar::where('employee_id', '=', $value->id)->where('month',$month)->where('year',$year)->first();\n\t\t\tif($calendar == null)\n\t\t\t{\n\t\t\t\t$calendar = $this->bornCalendarEmpty($value->id, $month, $year);\n\t\t\t}\n\t\t\t$this->generatePresenteWhenInitNewDate($calendar, $month, $year);\n\t\t\t$employees[$key]->calendar = $calendar;\n\t\t}\n\n?>\n <div id=\"datafullname\" style=\"display:none\"></div>\n <div class=\"sidebar-calendar\">\n <table>\n <thead>\n <tr><th><div class=\"nameitem\">Fullname</div></th></tr>\n </thead>\n <tbody>\n <tr class=\"itemblank\">\n <td><div class=\"nameitem\"></div></td>\n </tr>\n <?php foreach($employees as $key => $value) : ?>\n <tr>\n <!-- <td><div class=\"nameitem\">{{ $value->id }}</div></td> -->\n <td><div class=\"nameitem\" idem=\"<?php echo $value->id; ?>\"><?php echo $value->lastname.\" \".$value->firstname; ?></div></td>\n </tr>\n <?php endforeach;?>\n </tbody>\n </table>\n </div>\n <div class=\"content-calendar\">\n <div id=\"datacalendar\" style=\"display:none\"></div>\n <table>\n <thead>\n <tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ($i=1;$i<=31;$i++)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dt = null;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (checkDateValid($i, $month, $year)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dt = Carbon::create($year, $month, $i);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"<th><div class='day'>\".$i.\"<br/>\".toEnglishDate($dt->dayOfWeek).\"</div></th>\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t?>\n </tr>\n </thead>\n <tbody>\n <tr class=\"itemblank\">\n <td><div class=\"innerblank\"></div></td>\n </tr>\n <?php\n foreach($employees as $key => $value)\n {\n $calendar = $value->calendar;\n ?>\n <tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ($i=1;$i<=31;$i++)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$dt = Carbon::create($year, $month, $i);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (checkDateValid($i, $month, $year)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ($dt->dayOfWeek == 6 || $dt->dayOfWeek == 0)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td style=\"background-color:#ffbff7\"><div class=\"item\" idem=\"{{ $value->id }}\" idday=\"<?php echo $i;?>\" ><?php echo $calendar->{'n'.$i};?></div></td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td><div class=\"item\" idem=\"{{ $value->id }}\" idday=\"<?php echo $i;?>\" ><?php echo $calendar->{'n'.$i};?></div></td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n </tr>\n <?php\n }\n ?>\n\n </tbody>\n </table>\n </div>\n\n\t\t<?php\n\t}", "private function buildBodyDay()\n {\n\n $events = $this->events;\n $h = \"\";\n for ($i = $this->start_hour; $i < $this->end_hour; $i++) {\n for ($t = 0; $t < 2; $t++) {\n $h .= \"<tr>\";\n $min = $t == 0 ? \":00\" : \":30\";\n $h .= \"<td class='$this->timeClass'>\" . date('g:ia', strtotime($i . $min)) . \"</td>\";\n for ($k = 0; $k < 1; $k++) {\n $wd = $this->week_days[$k];\n $time_r = $this->year . '-' . $this->month . '-' . $wd . ' ' . $i . ':00:00';\n $min = $t == 0 ? '' : '+30 minute';\n $time_1 = strtotime($time_r . $min);\n $time_2 = strtotime(date('Y-m-d H:i:s', $time_1) . '+30 minute');\n $dt = date('Y-m-d H:i:s', $time_1);\n $h .= \"<td colspan='3' data-datetime='$dt'>\";\n $h .= $this->dateWrap[0];\n\n $hasEvent = false;\n foreach ($events as $key => $event) {\n //EVENT TIME AND DATE\n $time_e = strtotime($key);\n if ($time_e >= $time_1 && $time_e < $time_2) {\n $hasEvent = true;\n $h .= $this->buildEvents(false, $event);\n }\n }\n $h .= !$hasEvent ? '&nbsp;' : '';\n $h .= $this->dateWrap[1];\n $h .= \"</td>\";\n }\n $h .= \"</tr>\";\n }\n }\n $h .= \"</tbody>\";\n $h .= \"</table>\";\n\n $this->html .= $h;\n }" ]
[ "0.7477533", "0.7392036", "0.7086154", "0.7049579", "0.703222", "0.7010395", "0.6995145", "0.6987137", "0.6983575", "0.687349", "0.68351984", "0.6822865", "0.6801249", "0.67956764", "0.67782706", "0.67735076", "0.6663788", "0.66468054", "0.6645773", "0.6644275", "0.6528975", "0.6514362", "0.6497018", "0.64516073", "0.6395689", "0.6348838", "0.6339743", "0.6333883", "0.6285749", "0.6261756" ]
0.8193256
0
Creates Pagination for a given data array and with a number of records per page to display Solution based on
private function constructPagination($dataArr){ $currentPage = LengthAwarePaginator::resolveCurrentPage(); $col = new Collection($dataArr); $perPage = 10; $entries = new LengthAwarePaginator($col->forPage($currentPage, $perPage), $col->count(), $perPage, $currentPage); $entries->setPath(LengthAwarePaginator::resolveCurrentPath()); return $entries; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function buildPagination() {}", "protected function buildPagination() {}", "abstract public function preparePagination();", "function pager($current_page, $records_per_page, $pages_per_pageList, $dataQuery, $countQuery){\n $obj->record = array(); // beinhaltet ein Arrray des objects mit Daten wor&uuml;ber dann zugegriffen wird.\n $obj->current_page = $current_page; // Startet mit 0!\n $obj->total_cur_page = 0; // shows how many records belong to current page\n $obj->records_per_page = 0;\n $obj->total_records = 0;\n $obj->total_pages = 0;\n $obj->preceding = false; // Ist true wenn es eine Seite vor der angezeigten gibt.\n $obj->subsequent = false; // Ist true wenn es eine Seite nach der angezeigten gibt.\n $obj->pages_per_pageList = 10; //$pages_per_pageList;\n $result=mysql_query($countQuery, $this->CONNECTION);\n $obj->total_records = mysql_num_rows($result);\n if($obj->total_records>0){\n $obj->record = $this->select($dataQuery);\n $obj->total_cur_page = sizeof($obj->record);\n $obj->records_per_page = $records_per_page;\n $obj->total_pages = ceil($obj->total_records/$records_per_page);\n $obj->offset_page = $obj->pages_per_pageList*floor($obj->current_page/$obj->pages_per_pageList);\n $obj->total_pages_in_pageList = $obj->total_pages-($obj->offset_page+$obj->pages_per_pageList);\n $obj->last_page_in_pageList = $obj->offset_page+$obj->pages_per_pageList;\n if($obj->last_page_in_pageList>$obj->total_pages) $obj->last_page_in_pageList=$obj->total_pages;\n if($obj->offset_page>0) $obj->pageList_preceding=true;\n else $obj->pageList_preceding=false;\n if($obj->last_page_in_pageList<$obj->total_pages) $obj->pageList_subsequent=true;\n else $obj->pageList_subsequent=false;\n if($obj->current_page>1) $obj->preceding=true;\n if($obj->current_page<$obj->total_pages) $obj->subsequent=true;\n }\n return $obj;\n }", "protected function pagination(array $data)\n {\n $data['pageMin'] = $data['currentPage'] - SURROUND_COUNT;\n $data['pageMin'] = $data['pageMin'] > 0 ? $data['pageMin'] : 1;\n\n $data['pageMax'] = $data['currentPage'] + SURROUND_COUNT;\n $data['pageMax'] =\n $data['pageMax'] < $data['lastPage']\n ? $data['pageMax']\n : $data['lastPage'];\n\n $data['uri'] =\n BASE_URL .\n Functions::getStringBetween(\n rtrim($_SERVER['REQUEST_URI'], '/'),\n BASE_PATH,\n '/page',\n );\n\n $this->smarty->assign('paging', $data);\n $this->smarty->assign(\n 'pager',\n $this->smarty->fetch('Templates/pagination.tpl'),\n );\n }", "function paginate() {\n\t\t$all_rs = $this->db->query($this->sql );\n\t\t$this->total_rows = $all_rs->num_rows;\n\t\t\n\t\t//Return FALSE if no rows found\n\t\tif ($this->total_rows == 0) {\n\t\t\tif ($this->debug)\n\t\t\t\techo \"Query returned zero rows.\";\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t//Max number of pages\n\t\t$this->max_pages = ceil($this->total_rows / $this->rows_per_page );\n\t\tif ($this->links_per_page > $this->max_pages) {\n\t\t\t$this->links_per_page = $this->max_pages;\n\t\t}\n\t\t\n\t\t//Check the page value just in case someone is trying to input an aribitrary value\n\t\tif ($this->page > $this->max_pages || $this->page <= 0) {\n\t\t\t$this->page = 1;\n\t\t}\n\t\t\n\t\t//Calculate Offset\n\t\t$this->offset = $this->rows_per_page * ($this->page - 1);\n\t\t\n\t\t//Fetch the required result set\n\t\t$rs = $this->db->query($this->sql . \" LIMIT {$this->offset}, {$this->rows_per_page}\" );\n\t\t$this->data = $rs->rows;\n\t}", "public function getPaginationDataSource();", "public function findPaginate(array $data): array\n {\n }", "function pagination(){}", "private function generatePages()\n {\n $all_pages = self::getPages($this->records, $this->recordsInPage);\n $total = 0;\n $start = 1;\n while ($total < $all_pages) {\n $shift = $this->getShift();\n $paging_start = $total < $this->getLeftShift() ? true : false;\n $paging_end = $total >= ($all_pages - $this->getRightShift()) ? true : false;\n\n if ($this->currentPage == $start) {\n $this->appendData(sprintf('<li class=\"active\"><span>%d</span></li>', $start));\n }\n elseif ($paging_start|| $paging_end) {\n $this->appendData(sprintf('<li><a href=\"%s%d\">%d</a></li>', $this->url, $start, $start));\n }\n elseif (($this->currentPage == $start - $shift) || ($this->currentPage == $start + $shift)) {\n $this->appendData('<li><span>...</span></li>');\n }\n $total++;\n $start++;\n }\n }", "function paginator($data = [], $row_counts, $items_per_page = 10, $current_page = 1){\n\n\t$paginationCtrls = '';\n\n\t$last_page = ceil($row_counts/$items_per_page);\n\t$last_page = ($last_page < 1) ? 1 : $last_page;\n\n\t$current_page = preg_replace('/[^0-9]/', '', $current_page);\n\tif ( $current_page < 1 ) {\n\t\t$current_page = 1;\n\t}elseif ( $current_page > $last_page ) {\n\t\t$current_page = $last_page;\n\t}\n\t$limit_from = ($current_page - 1) * $items_per_page;\n\t$limit_to = $items_per_page;\n\n\t$result = array_slice($data, $limit_from, $limit_to);\n\n\t// Start first if\n\tif ( $last_page != 1 )\n\t{\n\t\t// Start second if\n\t\tif ( $current_page > 1 )\n\t\t{\n\t\t\t$previous = $current_page -1;\n\t\t\t$paginationCtrls .= '<a href=\"'. $_SERVER['PHP_SELF']. '?page='. $previous .'\">Previous</a> &nbsp;&nbsp;';\n\n\t\t\tfor($i=$current_page-4; $i < $current_page; $i++){\n\t\t\t\n\t\t\t\tif( $i > 0 ){\n\t\t\t\t\t$paginationCtrls .= '<a href=\"'. $_SERVER['PHP_SELF'] .'?page=' .$i. '\">'.$i.'</a> &nbsp;&nbsp; ';\n\t\t\t\t}\n\t\t\t}\n\t\t} // End second if\n\n\t\t$paginationCtrls .= ''.$current_page. ' &nbsp; ';\n\n\t\t\n\t\tfor($i=$current_page+1; $i <= $last_page ; $i++){\n\t\t\t$paginationCtrls .= '<a href=\"'. $_SERVER['PHP_SELF'] .'?page=' .$i. '\">'.$i.'</a> &nbsp;&nbsp; ';\n\t\t\t\n\t\t\tif( $i >= $current_page+4 ){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\n\n\n\t\tif( $current_page != $last_page ){\n\n\t\t\t$next = $current_page + 1;\n\t\t\t$paginationCtrls .= '&nbsp;&nbsp; <a href=\"'. $_SERVER['PHP_SELF'] .'?page=' .$next. '\">Next</a> &nbsp;&nbsp; ';\n\t\t}\n\t}\n\t// End first if\n\n\t// dd( ['last page => '.$last_page, 'current page => '.$current_page, 'limit => '.$limit_from] );\n\n\treturn ['result' => $result, 'links' => $paginationCtrls];\n}", "function paginate_list($obj, $data, $query_code, $variable_array=array(), $rows_per_page=NUM_OF_ROWS_PER_PAGE)\n{\n\t#determine the page to show\n\tif(!empty($data['p'])){\n\t\t$data['current_list_page'] = $data['p'];\n\t} else {\n\t\t#If it is an array of results\n\t\tif(is_array($query_code))\n\t\t{\n\t\t\t$obj->session->set_userdata('search_total_results', count($query_code));\n\t\t}\n\t\t#If it is a real query\n\t\telse\n\t\t{\n\t\t\tif(empty($variable_array['limittext']))\n\t\t\t{\n\t\t\t\t$variable_array['limittext'] = '';\n\t\t\t}\n\t\t\t\n\t\t\t#echo $obj->Query_reader->get_query_by_code($query_code, $variable_array );\n\t\t\t#exit($query_code);\n\t\t\t$list_result = $obj->db->query($obj->Query_reader->get_query_by_code($query_code, $variable_array ));\n\t\t\t$obj->session->set_userdata('search_total_results', $list_result->num_rows());\n\t\t}\n\t\t\n\t\t$data['current_list_page'] = 1;\n\t}\n\t\n\t$data['rows_per_page'] = $rows_per_page;\n\t$start = ($data['current_list_page']-1)*$rows_per_page;\n\t\n\t#If it is an array of results\n\tif(is_array($query_code))\n\t{\n\t\t$data['page_list'] = array_slice($query_code, $start, $rows_per_page);\n\t}\n\telse\n\t{\n\t\t$limittxt = \" LIMIT \".$start.\" , \".$rows_per_page;\n\t\t$list_result = $obj->db->query($obj->Query_reader->get_query_by_code($query_code, array_merge($variable_array, array('limittext'=>$limittxt)) ));\n\t\t$data['page_list'] = $list_result->result_array();\n\t}\n\t\n\treturn $data;\n}", "static function init($data){\n \n $pages = ceil($data['count_all'] / $data['limit']);\n \n $res = \"\";\n \n for($i = 1; $i <= $pages; $i++){\n \n if($i == $data['current_page'] ){ \n $res .= \"<b>$i</b>\";\n }\n else{\n $res .= \"<a href='\".$data['url'].\"&page=$i'>$i</a>\";\n }\n \n }\n \n \n return $res;\n \n \n \n \n }", "public function generatePagination()\n {\n $this->buffer = [];\n\n if ($this->currentPage != 1) {\n $this->generateLeftButton($this->currentPage);\n } else {\n $this->generateLeftButton($this->currentPage, true);\n }\n\n $this->generatePages();\n\n if ($this->currentPage != self::getPages($this->records, $this->recordsInPage)) {\n $this->generateRightButton($this->currentPage);\n } else {\n $this->generateLeftButton($this->currentPage, true);\n }\n }", "private function _pagination()\n {\n\n if (Request::has('pq_curpage') && Request::has('pq_rpp')) {\n $columnsTemp = $this->_columnsRaw;\n $pq_curPage = Request::input('pq_curpage');\n $pq_rPP = Request::input('pq_rpp');\n $queryTemp = new \\stdClass();\n $queryTemp = $this->_getQueryStatement();\n $queryTemp->columns = null;\n\n // Verifica si existe algun filtro para aplicarlo al COUNT y determinar cuantos registros hay en la consulta\n if (property_exists($this->_filterTable, 'query')) {\n $queryTemp->whereRaw($this->_filterTable->query, $this->_filterTable->param);\n }\n\n $totalRecordQuery = $queryTemp->count();\n $this->_query->columns = $columnsTemp;\n\n $skip = ($pq_rPP * ($pq_curPage - 1));\n\n if ($skip >= $totalRecordQuery) {\n $pq_curPage = ceil($totalRecordQuery / $pq_rPP);\n $skip = ($pq_rPP * ($pq_curPage - 1));\n }\n\n // Make limit to query\n $this->_query->offset($skip)\n ->limit($pq_rPP);\n\n $this->_paginationLimit = [\n 'totalRecords' => $totalRecordQuery,\n 'curPage' => $pq_curPage,\n ];\n }\n }", "private function paging(array $input)\n\t{\n \n $actualPage = $input['actualPage'];\n $allRecords = $this->getCountItems(array());\n\n $recordsPerPage = $this->paging['recordsPerPage'];\n \n $pages = $allRecords / $recordsPerPage;\n\n if (($count - ($_pages * $this->records_per_page)) > 0){\n $_pages++;\n }\n \n $_pages = ceil($_pages);\n for ($i = 0; $i < $_pages; $i++){\n $page['cislo'] = $i + 1;\n $pages[] = $page;\n\n }\n\n if ($actualPage > 1){\n $prev = $actualPage - 1;\n }\n\n if ($actualPage < $pages){\n $next = $actualPage + 1;\n }\n\n $from = ($actualPage - 1) * $recordsPerPage;\n $to = (($actualPage - 1) * $recordsPerPage) + $recordsPerPage;\n\n\n\n return array(\n 'page' => $actualPage,\n 'prev' => $prev,\n 'next' => $next,\n 'from' => $from,\n 'to' => $to,\n 'perPage' => $recordsPerPage,\n );\n\t}", "function buildPagination($pageData) {\r\n $currentPage = $pageData['current_page'];\r\n $total = $pageData['total'];\r\n $perPage = $pageData['showing'];\r\n $term = $pageData['term'];\r\n \r\n $previous = '<a class=\"previous\" href=\"/' . $term . '/page:' . ($currentPage - 1) . '\">Previous</a> ';\r\n $next = ' <a class=\"next\" href=\"/' . $term . '/page:' . ($currentPage + 1) . '\">Next</a>';\r\n\r\n\t\tif ($perPage == 0) {\r\n\t\t\t$perPage = Configure::read('Flickr.settings.photos_per_page') - 1;\r\n\t\t}\r\n\r\n $middle = '<span>Page <strong>' . $currentPage . '</strong> of ' . ceil($total / $perPage) . '</span>';\r\n if ($currentPage == 1) {\r\n return '<div class=\"page-list\">' . $middle . $next . '</div>'; \r\n } \r\n elseif ($currentPage == $total) {\r\n return '<div class=\"page-list\">' . $previous . $middle . '</div>';\r\n }\r\n\r\n return '<div class=\"page-list\">' . $previous . $middle . $next . '</div>'; \r\n }", "public function getPaginate ($p_rowsPerPage, $p_currentPage);", "function paging_1($sql,$vary=\"record\",$width=\"575\",$course)\n{\n\n global $limit,$offset,$currenttotal,$showed,$last,$align,$CFG;\n if(!empty ($_REQUEST['offset']))\n $offset=$_REQUEST['offset'];\n else $offset=0;\n $showed=$offset+$limit;\n $last=$offset-$limit;\n $result=get_records_sql($sql);\n\n $currenttotal=count($result);\n $pages=$currenttotal%$limit;\n if($pages==0)\n\t$pages=$currenttotal/$limit;\n else\n {\n\t$pages=$currenttotal/$limit;\n\t$pages=(int)$pages+1;\n }\n for($i=1;$i<=$pages;$i++)\n {\n\t$pageoff=($i-1)*$limit;\n\tif($showed==($i*$limit))\n\tbreak;\n }\n\t\t\t\n if($currenttotal>1)$vary.=\"s\";\n if($currenttotal>0)\n\techo @$display;\n if($CFG->dbtype==\"mysql\")\n {\n $sql.=\" Limit \".$offset.\",$limit \";\n }\n else if($CFG->dbtype==\"mssql_n\" )\n {\n $uplimit=$offset+$limit;\n $sql.=\" WHERE Row between \".($offset+1).\" and \".$uplimit;\n\n }\n\n return $sql;\n\n}", "protected function buildPagination()\n {\n $this->calculateDisplayRange();\n $pages = [];\n for ($i = $this->displayRangeStart; $i <= $this->displayRangeEnd; $i++) {\n $pages[] = [\n 'number' => $i,\n 'offset' => ($i - 1) * $this->itemsPerPage,\n 'isCurrent' => $i === $this->currentPage\n ];\n }\n $pagination = [\n 'linkConfiguration' => $this->linkConfiguration,\n 'pages' => $pages,\n 'current' => $this->currentPage,\n 'numberOfPages' => $this->numberOfPages,\n 'lastPageOffset' => ($this->numberOfPages - 1) * $this->itemsPerPage,\n 'displayRangeStart' => $this->displayRangeStart,\n 'displayRangeEnd' => $this->displayRangeEnd,\n 'hasLessPages' => $this->displayRangeStart > 2,\n 'hasMorePages' => $this->displayRangeEnd + 1 < $this->numberOfPages\n ];\n if ($this->currentPage < $this->numberOfPages) {\n $pagination['nextPage'] = $this->currentPage + 1;\n $pagination['nextPageOffset'] = $this->currentPage * $this->itemsPerPage;\n }\n if ($this->currentPage > 1) {\n $pagination['previousPage'] = $this->currentPage - 1;\n $pagination['previousPageOffset'] = ($this->currentPage - 2) * $this->itemsPerPage;\n }\n return $pagination;\n }", "public function buildPagination($data)\n\t{\n\t\t$pagination = is_array($data) ? $data : $data->toArray();\n\t\tunset($pagination['data']);\n\n\t\treturn $pagination;\n\t}", "public function createPages() {\n $pageCount = $this->getPageCount();\n $currentPageNumber = $this->getCurrentPage();\n\n $structure = new XGrid_Plugin_Pagination_Structure();\n $structure->setPageCount($pageCount);\n $structure->setItemCountPerPage($this->getItemCountPerPage());\n $structure->setFirst(1);\n $structure->setCurrent($currentPageNumber);\n $structure->setLast($pageCount);\n\n // Previous and next\n if ($currentPageNumber - 1 > 0) {\n $structure->setPrevious($currentPageNumber - 1);\n }\n \n if ($currentPageNumber + 1 <= $pageCount) {\n $structure->setNext($currentPageNumber + 1);\n }\n\n // Pages in range\n $scrollingStyle = $this->getScrollingStyle();\n $structure->setPagesInRange($scrollingStyle->getPages($this));\n $structure->setFirstPageInRange(min($structure->getPagesInRange()));\n $structure->setLastPageInRange(max($structure->getPagesInRange()));\n \n $this->_structure = $structure; \n }", "public static function pagination()\n {\n $limit = (int) self::set(\"limit\");\n $offset = (int) self::set(\"offset\");\n\n $limit = Validator::intType()->notEmpty()->positive()->validate($limit)? $limit: false;\n $offset = Validator::intType()->notEmpty()->positive()->validate($offset)? $offset: 0;\n\n $pagination = \"\";\n $pagination .= $limit? \" LIMIT {$limit}\": null;\n $pagination .= ($limit && $offset)? \" OFFSET {$offset}\": null;\n\n return (object) [\n \"limit\" => $limit,\n \"offset\" => $offset,\n \"query\" => $pagination\n ];\n }", "function newPaging($data) {\n $batas = $data['setPage'];\n $halaman = $data['halaman'];\n if (empty($halaman)) {\n $posisi = 0;\n $halaman = 1;\n } else {\n $posisi = ($halaman - 1) * $batas;\n }\n\n //Langkah 2: Sesuaikan perintah SQL\n $tampil = \"SELECT * FROM anggota LIMIT $posisi,$batas\";\n //print_r($tampil);\n $hasil = mysql_query($tampil);\n\n $no = $posisi + 1;\n while ($r = mysql_fetch_array($hasil)) {\n echo \"<tr><td>$no</td><td>$r[nama]</td><td>$r[alamat]</td></tr>\";\n $no++;\n }\n echo \"</table><br>\";\n\n //Langkah 3: Hitung total data dan halaman \n $tampil2 = mysql_query(\"SELECT * FROM anggota\");\n $jmldata = mysql_num_rows($tampil2);\n $jmlhal = ceil($jmldata / $batas);\n\n echo \"<div class=paging>\";\n // Link ke halaman sebelumnya (previous)\n if ($halaman > 1) {\n $prev = $halaman - 1;\n echo \"<span class=prevnext><a href=$_SERVER[PHP_SELF]?halaman=$prev>« Prev</a></span> \";\n } else {\n echo \"<span class=disabled>« Prev</span> \";\n }\n\n // Tampilkan link halaman 1,2,3 ...\n for ($i = 1; $i <= $jmlhal; $i++)\n if ($i != $halaman) {\n if (isset($_GET['setPage'])) {\n $setPage = $_GET['setPage'];\n echo \" <a href=$_SERVER[PHP_SELF]?halaman=$i&setPage=$setPage>$i</a> \";\n } else {\n echo \" <a href=$_SERVER[PHP_SELF]?halaman=$i>$i</a> \";\n }\n } else {\n echo \" <span class=current>$i</span> \";\n }\n\n // Link kehalaman berikutnya (Next)\n if ($halaman < $jmlhal) {\n $next = $halaman + 1;\n echo \"<span class=prevnext><a href=$_SERVER[PHP_SELF]?halaman=$next>Next »</a></span>\";\n } else {\n echo \"<span class=disabled>Next »</span>\";\n }\n echo \"</div>\";\n}", "public function generatePagenation($resultData, $current_page, $result_number, $size = 5, $max_show_page = null)\n {\n $max_show_page = isset($max_show_page) ? $max_show_page : 11;\n $all_pages = intval(ceil($result_number / $size));\n $current_page = intval(isset($current_page) ? $current_page : 1);\n $current_page = min(max(1, $current_page), $all_pages);\n\n $current_range_start = $current_page - round($max_show_page /2);\n $current_range_end = $current_range_start + $max_show_page;\n\n if ($current_range_start < 1) $current_range_end = $max_show_page;\n if ($current_range_end > $all_pages) $current_range_start = $all_pages - $max_show_page;\n\n $current_range_start = max(1, $current_range_start);\n $current_range_end = min($all_pages, $current_range_end);\n\n if (is_object($resultData))\n {\n $resultData->all_pages = $all_pages;\n $resultData->current_range_start = $current_range_start;\n $resultData->current_range_end = $current_range_end;\n $resultData->current_page = $current_page;\n } else {\n $resultData['all_pages'] = $all_pages;\n $resultData['current_range_start'] = $current_range_start;\n $resultData['current_range_end'] = $current_range_end;\n $resultData['current_page'] = $current_page;\n }\n\n return $resultData;\n }", "private function createLengthAwarePaginator()\n {\n $this->pagination = true;\n\n $this->_paginate_current = $this->data->currentPage();\n\n $this->_paginate_total = $this->data->lastPage();\n\n $this->data = $this->data->all();\n\n $this->normalize();\n }", "function paging($tablename, $where, $orderby, $url, $PageNo, $PageSize, $Pagenumber, $ModePaging) {\n if ($PageNo == \"\") {\n $StartRow = 0;\n $PageNo = 1;\n }\n else {\n $StartRow = ($PageNo - 1) * $PageSize;\n }\n if ($PageSize < 1 || $PageSize > 1000) {\n $PageSize = 15;\n }\n if ($PageNo % $Pagenumber == 0) {\n $CounterStart = $PageNo - ($Pagenumber - 1);\n }\n else {\n $CounterStart = $PageNo - ($PageNo % $Pagenumber) + 1;\n }\n $CounterEnd = $CounterStart + $Pagenumber;\n $sql = \"SELECT COUNT(id) FROM \" . $tablename . \" where \" . $where;\n $result_c = $this->doSQL($sql);\n $row = mysql_fetch_array($result_c);\n $RecordCount = $row[0];\n $result = $this->getDynamic($tablename, $where, $orderby . \" LIMIT \" . $StartRow . \",\" . $PageSize);\n if ($RecordCount % $PageSize == 0)\n $MaxPage = $RecordCount / $PageSize;\n else\n $MaxPage = ceil($RecordCount / $PageSize);\n $gotopage = \"\";\n switch ($ModePaging) {\n case \"Full\" :\n $gotopage = '<div class=\"paging_meneame\">';\n if ($MaxPage > 1) {\n if ($PageNo != 1) {\n $PrevStart = $PageNo - 1;\n $gotopage .= ' <a href=\"' . $url . '&PageNo=1\" tile=\"First page\"> &laquo; </a>';\n $gotopage .= ' <a href=\"' . $url . '&PageNo=' . $PrevStart . '\" title=\"Previous page\"> &lsaquo; </a>';\n }\n else {\n $gotopage .= ' <span class=\"paging_disabled\"> &laquo; </span>';\n $gotopage .= ' <span class=\"paging_disabled\"> &lsaquo; </span>';\n }\n $c = 0;\n for ($c = $CounterStart; $c < $CounterEnd;++$c) {\n if ($c <= $MaxPage)\n if ($c == $PageNo)\n $gotopage .= '<span class=\"paging_current\"> ' . $c . ' </span>';\n else\n $gotopage .= ' <a href=\"' . $url . '&PageNo=' . $c . '\" title=\"Page ' . $c . '\"> ' . $c . ' </a>';\n }\n if ($PageNo < $MaxPage) {\n $NextPage = $PageNo + 1;\n $gotopage .= ' <a href=\"' . $url . '&PageNo=' . $NextPage . '\" title=\"Next page\"> &rsaquo; </a>';\n }\n else {\n $gotopage .= ' <span class=\"paging_disabled\"> &rsaquo; </span>';\n }\n if ($PageNo < $MaxPage)\n $gotopage .= ' <a href=\"' . $url . '&PageNo=' . $MaxPage . '\" title=\"Last page\"> &raquo; </a>';\n else\n $gotopage .= ' <span class=\"paging_disabled\"> &raquo; </span>';\n }\n $gotopage .= ' </div>';\n break;\n }\n $arr[0] = $result;\n $arr[1] = $gotopage;\n $arr[2] = $tablename;\n return $arr;\n }", "public function pagination_numbers_set(){\n\t\t\t$this->pages_show_array = array();\n\t\t\t$this->pages_show_array['middle'] = array();\n\t\t\t$this->pages_show_array['prev'] = null;\n\t\t\t$this->pages_show_array['next'] = null;\n\t\t\t$this->pages_show_array['first'] = null;\n\t\t\t$this->pages_show_array['last'] = null;\n\n\t\t\t\n\t\t\tfor ($i=0; $i < sizeof($this->pages_array) ;$i++){\n\n\t\t\t\t//first iteration\n\t\t\t\tif ($i == 0){\n\t\t\t\t\t//prev\n\t\t\t\t\tif ($this->current_page <= 1){\n\t\t\t\t\t\t$this->pages_show_array['prev'] = null;\n\t\t\t\t\t}\n\t\t\t\t\telse if ($this->current_page >= $this->total_pages){\n\t\t\t\t\t\t$this->pages_show_array['prev'] = $this->total_pages - 1;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$this->pages_show_array['prev'] = $this->current_page - 1;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($this->current_page > $this->pages_to_show){\n\t\t\t\t\t\t$this->pages_show_array['first'] = \"1 ...\";\n\t\t\t\t\t}\n\n\n\t\t\t\t\tarray_push($this->pages_show_array['middle'], $this->pages_array[$i]);\n\n\n\t\t\t\t}\n\n\t\t\t\t//last iteration\n\t\t\t\telse if ($i == sizeof($this->pages_array)-1){\n\n\t\t\t\t\tif ($this->current_page < $this->total_pages - $this->pages_to_show){\n\t\t\t\t\t\t$this->pages_show_array['last'] = \"...\" . $this->total_pages;\n\t\t\t\t\t}\n\n\n\t\t\t\t\t//next\n\t\t\t\t\tif ($this->current_page >= $this->total_pages){\n\t\t\t\t\t\t$this->pages_show_array['next'] = null;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$this->pages_show_array['next'] = $this->current_page + 1;\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//middle iterations\n\t\t\t\telse {\n\t\t\t\t\tarray_push($this->pages_show_array['middle'], $this->pages_array[$i]);\n\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\t\n\n\t\t\t\tif (empty($this->pages_show_array['next'])){\n\t\t\t\t\t$this->pages_show_array['next'] = null;\n\t\t\t\t}\n\t\t\t\n\n\t\t}", "public function do_paging()\n {\n }", "protected function populateData($param, $data)\n\t{\n\t\t$total = $data instanceof TList ? $data->getCount() : count($data);\n\t\t$pageSize = $this->getPageSize();\n\t\tif($total < 1)\n\t\t{\n\t\t\t$param->setData($data);\n\t\t\t$this->_prevPageList = null;\n\t\t\t$this->_nextPageList = null;\n\t\t\treturn;\n\t\t}\n\n\t\tif($param->getNewPageIndex() < 1)\n\t\t{\n\t\t\t$this->_prevPageList = null;\n\t\t\tif($total <= $pageSize)\n\t\t\t{\n\t\t\t\t$param->setData($data);\n\t\t\t\t$this->_nextPageList = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$param->setData(array_slice($data, 0, $pageSize));\n\t\t\t\t$this->_nextPageList = array_slice($data, $pageSize-1,$total);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif($total <= $pageSize)\n\t\t\t{\n\t\t\t\t$this->_prevPageList = array_slice($data, 0, $total);\n\t\t\t\t$param->setData(array());\n\t\t\t\t$this->_nextPageList = null;\n\t\t\t}\n\t\t\telse if($total <= $pageSize*2)\n\t\t\t{\n\t\t\t\t$this->_prevPageList = array_slice($data, 0, $pageSize);\n\t\t\t\t$param->setData(array_slice($data, $pageSize, $total));\n\t\t\t\t$this->_nextPageList = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_prevPageList = array_slice($data, 0, $pageSize);\n\t\t\t\t$param->setData(array_slice($data, $pageSize, $pageSize));\n\t\t\t\t$this->_nextPageList = array_slice($data, $pageSize*2, $total-$pageSize*2);\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.71911424", "0.71911424", "0.6706617", "0.6704734", "0.66460437", "0.6541788", "0.65004593", "0.64607495", "0.639451", "0.6369193", "0.6365944", "0.63075614", "0.6303151", "0.6286792", "0.6261076", "0.6258619", "0.6243266", "0.6224657", "0.6145747", "0.61237186", "0.60882473", "0.6086223", "0.60606545", "0.60337305", "0.6027626", "0.6027182", "0.59888357", "0.5973273", "0.5969205", "0.59653527" ]
0.72358215
0
Cuts the power to motor controller board
public function powerDown() { if ($this->motor_power) $this->motor_power->setValue(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function powerUp()\n {\n if ($this->motor_power)\n $this->motor_power->setValue(1);\n }", "public function wipers_off() {\r\n echo PHP_EOL;\r\n $this->action(\"turning windshield wipers off\");\r\n $this->wipers_on = FALSE;\r\n $this->action(\"windshield wipers are off\");\r\n }", "public function headlights_off() {\r\n echo PHP_EOL;\r\n $this->action(\"turning headlights off\");\r\n $this->lights_on = FALSE;\r\n $this->action(\"headlights are off\");\r\n\r\n }", "public function tiltDownCamaraPresidencia() {\n\n self::$presidencia->moverAbajo();\n\n }", "public function cut()\n {\n }", "public function turnWheel() {\n\n $this->setGumballs($this->getGumballs() - 1);\n }", "public function Stop()\r\n {\r\n echo \"<b><u>Command Received: Stop Vehicle</b></u><br />\";\r\n echo $this->carName . \"'s current speed is \" . $this->speed . \".<br />\";\r\n echo \"Stopping...<br />\";\r\n $this->speed = 0;\r\n echo $this->carName . \" is now travelling at \" . $this->speed . \" mph. <br />\";\r\n }", "private function clean() {\n echo $this->floor->areaRemainsToClean();\n while ($this->floor->areaRemainsToClean()) {\n $this->useBattery();\n }\n }", "public function charging(): void\n {\n $this->capacity = 1;\n }", "public function ShutdownCar()\r\n {\r\n echo \"<b><u>Command Received: Shutdown Engine</b></u><br />\";\r\n if($this->speed > 0)\r\n {\r\n echo \"Stopping prior to shutting down the engine... <br />\";\r\n $this->speed = 0;\r\n }\r\n $this->carEngine->stopEngine();\r\n echo $this->carName . \"'s engine has been shut down <br />\";\r\n }", "public function usb()\n {\n }", "public function eraseDown(): void\n {\n static::writeDirectly(\"\\e[J\");\n }", "function porte1() {\n\t\tsystem (\"gpio write 21 off\");\n\t\tsleep ( 1 );\n\t\tsystem (\"gpio write 21 on\");\n\t\t}", "private function ledOff()\n {\n $this->ledPin->setValue(PinInterface::VALUE_LOW);\n }", "function eis_device_poweroff() {\n\tglobal $eis_conf,$eis_dev_conf,$eis_dev_status,$eis_mysqli;\n\t// do nothing\n\treturn true;\n}", "public function turnOff() //Einschalten geht nur über WOL! \n { \n $this->lg_handshake();\n $command = '{\"id\":\"turnOff\",\"type\":\"request\",\"uri\":\"ssap://system/turnOff\"}'; \n $this->send_command($command); \n }", "public function shutDoor()\n {\n return false;\n }", "public function startPowerUnits() {\n\t\techo \"power units started.<br>\";\n\t\t$this->missionControl->setState($this->missionControl->getRetractArms());\n\t}", "public function startPowerUnits() {\n\t\t\n\t}", "public function tiltDownCamaraAlumnos1() {\n\n self::$alumnos1->moverAbajo();\n\n }", "public function desactivarProyectorCentral( ) {\n\n $this->setComando(self::$PROYECTOR_CENTRAL, \"MUTE\");\n\n }", "public function switchOn();", "public function putDown();", "public function tiltDownCamaraAlumnos2() {\n\n self::$alumnos2->moverAbajo();\n\n }", "public function setFluidsOilMotor($value) {\n switch ($value) {\n case 0 : // Sin da�o\n return 0;\n break;\n case 6 : // Malo\n return 10;\n break;\n }\n }", "public function shift()\n {\n \n }", "private function clearBuildArea() {\n $plugin = SJTTournamentTools::getInstance();\n\t\t$level = Server::getInstance()->getDefaultLevel();\n\t\t$location = $plugin->getLocationManager()->getLocation('Build');\n\n\t\t$lengthx = self::PLATFORM_COUNT_X * (self::PLATFORM_WIDTH + 1);\n\t\t$lengthz = self::PLATFORM_COUNT_Z * (self::PLATFORM_WIDTH + 1);\n\n // TEMP clear large area 4 x 5 squares\n /*for ($x = -5; $x < self::PLATFORM_WIDTH * 4 + 5; $x++) {\n\t\t\tfor ($z = -5; $z < self::PLATFORM_WIDTH * 5 + 5; $z++) {\n\t\t\t\t$newx = $location['x'] + $x;\n\t\t\t\t$newy = $location['y'];\n\t\t\t\t$newz = $location['z'] + $z;\n\n\t\t\t\t$level->setBlock(new Vector3($newx, $newy, $newz), new Air(), false, false);\n\t\t\t}\n\t\t}*/\n\n // Clear area above platforms\n\t\tfor ($x = 0; $x < $lengthx; $x++) {\n\t\t\tfor ($y = 0; $y < self::AIR_CLEARANCE; $y++) {\n\t\t\t\tfor ($z = 0; $z < $lengthz; $z++) {\n\t\t\t\t\t$newx = $location['x'] + $x;\n\t\t\t\t\t$newy = $location['y'] + $y + 1;\n\t\t\t\t\t$newz = $location['z'] + $z;\n\t\t\t\t\t$level->setBlock(new Vector3($newx, $newy, $newz), new Air(), false, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n // Rebuild platforms and gaps between\n\t\tfor ($x = 0; $x < $lengthx; $x++) {\n\t\t\tfor ($z = 0; $z < $lengthz; $z++) {\n\t\t\t\t$newx = $location['x'] + $x;\n\t\t\t\t$newy = $location['y'];\n\t\t\t\t$newz = $location['z'] + $z;\n\t\t\t\tif (!($x % (self::PLATFORM_WIDTH + 1)) || !($z % (self::PLATFORM_WIDTH + 1))) {\n\t\t\t\t\t$level->setBlock(new Vector3($newx, $newy, $newz), new Air(), false, false);\n\t\t\t\t} else {\n\t\t\t\t\t$level->setBlock(new Vector3($newx, $newy, $newz), new Quartz(), false, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n // Remove entities within build area\n $entities = $level->getEntities();\n foreach($entities as $entity) {\n if (!$entity instanceof Player &&\n $entity->getX() >= $location['x'] && $entity->getX() <= $location['x'] + $lengthx &&\n $entity->getZ() >= $location['z'] && $entity->getZ() <= $location['z'] + $lengthz) {\n\n $entity->kill();\n }\n }\n }", "public function setPower()\n {\n $this->_role->power = 200;\n }", "public function ledsOff()\n {\n $payload = '';\n\n $this->sendRequest(self::FUNCTION_LEDS_OFF, $payload);\n }", "function revItUp($x) {\r\n return $this->speedometer + 5; \r\n }" ]
[ "0.61525005", "0.5422426", "0.5267127", "0.522891", "0.52227116", "0.5096829", "0.50050414", "0.5002043", "0.50003695", "0.49834076", "0.49579746", "0.484042", "0.4826675", "0.48074186", "0.48030967", "0.47433087", "0.46998537", "0.46993312", "0.46944326", "0.46933746", "0.46555626", "0.4620262", "0.4612576", "0.45846063", "0.45845875", "0.4576097", "0.45698646", "0.45610508", "0.45553342", "0.45471787" ]
0.62825936
0
retorna los saldos de todos los bancos
public function getSaldoBancos(){ $bancos = $this->getList(new UIBancoCriteria()); $saldos = 0; foreach ($bancos as $banco) { $saldos += $banco->getSaldo(); } return $saldos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function buscarSalas($sala){\n $listado = [];\n \n #Consulto el tipo de servicio...\n $id = new MongoDB\\BSON\\ObjectId($sala);\n //'eliminado'=>false,'status'=>true,\n $res_servicios = $this->mongo_db->order_by(array('_id' => 'DESC'))->where(array(\"_id\"=>$id))->get(\"servicios\");\n\n foreach ($res_servicios as $claves => $valor) {\n $valor[\"id_salas\"] = (string)$valor[\"_id\"]->{'$id'};\n $valor[\"monto\"] = number_format($valor[\"monto\"],2);\n $listado[] = $valor; \n }\n return $listado;\n }", "public function cargaSalon(Request $request){\n \t$id_sesion=$request->id;\n \t\n \t$salon=[];\n\n\t\t//butacas resevadas en esa sesion (directo el seiosn id)\n\t\t$butacas_reservadas=Butaca::whereHas('sesion', function ($query) use ($id_sesion) {\n \t\t$query->where('sesion_id', $id_sesion);\n\t\t})->get()->toArray();\n\t\t \n\t\t\n\n\t\t//butacas bloqueadas por esa sesion\t\t(sacar las reservas con sesion_id)\n\t\t$butacas_bloqueadas=Butaca::where(\"sesion_id\",$id_sesion)->get()->toArray();\n\t\t\n\n\t\t$butacas_ocupadas = array_merge($butacas_reservadas, $butacas_bloqueadas);\n\t\t\n\t\tfor($i=1;$i<=Config('constants.options.filas_sala');$i++){\n\t\t\tfor($j=1;$j<=Config('constants.options.columnas_sala');$j++){\n\t\t\t\t$ocupada=\"false\";\n\t\t\t\tfor ($b=0;$b<count($butacas_ocupadas);$b++) {\n\t\t\t\t\tif($butacas_ocupadas[$b][\"fila\"]==$i and $butacas_ocupadas[$b][\"columna\"]==$j){\n\t\t\t\t\t\t$ocupada=\"true\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$salon[]=[\"fila\"=>$i,\"columna\"=>$j,\"ocupada\"=>$ocupada];\n\t\t\t}\n\t\t}\n//\t\tdd($salon);\n\n\n \treturn json_encode($salon);\n\n }", "public function getSalons()\r\n {\r\n return $this->salons;\r\n }", "public function obtenerSaldo();", "public function getSalones(){\n\t\t$filasPagina = 7;//registros mostrados por página\n\n\t\tif(isset($_GET['pagina'])){//si le pasamos el valor \"pagina\" de la url (si el usuario da click en la paginación)\n\t\t\t\tif($_GET['pagina']==1){\n\t\t\t\t$pagina=1; \n\t\t\t\theader(\"Location: principal.php?c=controlador&a=muestraSalones\");\n\t\t\t\t}else{\n\t\t\t\t\t$pagina=$_GET['pagina'];//índice que indica página actual\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$pagina=1;//índice que indica página actual\n\t\t\t}\n\n\t\t\t$empezarDesde = ($pagina-1) * $filasPagina;\n\n\t\t\t$sql = \" SELECT * FROM salones \";\n\n\t\t\t$resultado = $this->db->query($sql);\n\n\t\t\t$resultado->execute(array());\n\n\t\t\t$numFilas = $resultado->rowCount();//número de registos totales de la consulta\n\n\t\t\t//ceil — Redondear fracciones hacia arriba\n\t\t\t$totalPaginas = ceil($numFilas / $filasPagina);//calcula cuántas páginas serán en total para mostrar todos los registros\n\n\t\t\t$resultado->closeCursor();\n\n\t\t//------------------------- Consulta para mostrar los resultados ---------------------------\n\n\t\t\t$sql_limite = \" SELECT * FROM salones LIMIT $empezarDesde , $filasPagina \";\n\n\t\t\t$resultado = $this->db->query($sql_limite);//ejecutando la consulta con la conexión establecida\n\n\t\t\twhile($row = $resultado->fetch(PDO::FETCH_ASSOC)){\n\t\t\t\t$this->objeto[] = $row;//llenando array con valores de la consulta\n\t\t\t}\n\n\t\treturn $this->objeto;\n\t}", "public function ListarSalas()\n{\n\tself::SetNames();\n\t$sql = \" select * from salas\";\n\tforeach ($this->dbh->query($sql) as $row)\n\t{\n\t\t$this->p[] = $row;\n\t}\n\treturn $this->p;\n\t$this->dbh=null;\n}", "private function getSaldo()\n {\n return $this->saldo;\n }", "public function getSabores(){\n $sabores = TcSabor::where('id_estado','=',1)->get();\n return $sabores;\n }", "public function GetSaldoTotalProveedores()\n {\n \t\n \n \t// No mostrar Insumos a contabilizar, exite otro procedimiento para tratarlas\n \t// Insumos a contabilizar\n \t$CONST_InsumosAContabilizarId = 5;\n \t\n \t$q\t=\tDoctrine_Query::create()\n \t->from('Proveedor c')\n \t->innerJoin('c.FacturasCompra f')\n \t->andWhere('f.TipoGastoId <> ?', $CONST_InsumosAContabilizarId)\n \t->groupBy('c.Id');\n //echo $q->getSqlQuery();\n \t$cli\t=\t$q->execute();\n \t$total=0;\n \tforeach ($cli as $c)\n \t{\n \t\t\t$saldoActual\t=\t$c->GetSaldo();\n \t\t\t$c->SaldoActual\t=\t$saldoActual;\n \t\t\t$c->save();\n\t\t\t\t\t// sumar saldo total de cada cliente\n \t\t\t$total\t+= $saldoActual;\n \t}\n \n \treturn $total;\n }", "public function get_saldo_caja($sucursal){\n\t$conectar= parent::conexion();\n\tparent::set_names();\n \n\t$sql=\"select saldo from caja_chica where sucursal=?;\";\n\t$sql=$conectar->prepare($sql);\n\t$sql->bindValue(1,$sucursal);\n\t$sql->execute();\n\treturn $resultado= $sql->fetchAll(PDO::FETCH_ASSOC);\n}", "function getCreditosComprometidos(){ return $this->getOEstats()->getTotalCreditosSaldo(); }", "public function getSaldo()\n {\n return $this->saldo;\n }", "public function getSaldo()\n {\n return $this->saldo;\n }", "public function getSaldoBanco(UIBancoCriteria $criteria){\n\n\t\t$bancos = $this->getList($criteria);\n\t\t$saldos = 0;\n\t\tforeach ($bancos as $banco) {\n\t\t\t$saldos += $banco->getSaldo();\n\t\t}\n\t\treturn $saldos;\n\t}", "function salida_por_traspaso(){\n\t\t$e= new Salida();\n\t\t$e->usuario_id=$GLOBALS['usuarioid'];\n\t\t$e->empresas_id=$GLOBALS['empresaid'];\n\t\t$related = $e->from_array($_POST);\n\t\t//if($e->costo_unitario=='undefined') $e->costo_unitario=0;\n\t\t$e->espacios_fisicos_id=$GLOBALS['espacios_fisicos_id'];\n\t\t$e->costo_total=($e->cantidad * $e->costo_unitario);\n\t\t$e->cclientes_id=1;\n\t\t$e->fecha=date(\"Y-m-d H:i:s\");\n\t\tif($e->id==0)\n\t\t\tunset($e->id);\n\t\tif($e->save($related)) {\n\t\t\techo $e->id;\n\t\t} else\n\t\t\techo 0;\n\t}", "public function cadastrarHabilidade($dados){\n \n return $this->salvar($dados);\n\t}", "public function salvar() {\n\n if (!db_utils::inTransaction()) {\n throw new Exception(_M('patrimonial.patrimonio.Bem.sem_transacao'));\n }\n\n /**\n * Realizamos algumas validações básicas\n */\n if ($this->oPlaca == null || !$this->oPlaca instanceof PlacaBem) {\n throw new Exception(_M('patrimonial.patrimonio.Bem.placa_nao_definida'));\n }\n if (!$this->getFornecedor() instanceof CgmBase) {\n throw new Exception(_M('patrimonial.patrimonio.Bem.informe_fornecedor'));\n }\n if (!$this->getClassificacao() instanceof BemClassificacao) {\n throw new Exception(_M('patrimonial.patrimonio.Bem.informe_classificacao'));\n }\n /**\n * Dados da tabela bens\n */\n $oDaoBens = new cl_bens();\n $oDaoBens->t52_bensmarca = \"{$this->getMarca()}\";\n $oDaoBens->t52_bensmedida = \"{$this->getMedida()}\";\n $oDaoBens->t52_bensmodelo = \"{$this->getModelo()}\";\n $oDaoBens->t52_codcla = $this->getClassificacao()->getCodigo();\n $oDaoBens->t52_depart = $this->getDepartamento();\n $oDaoBens->t52_descr = $this->getDescricao();\n $oDaoBens->t52_dtaqu = $this->getDataAquisicao();\n $oDaoBens->t52_instit = $this->getInstituicao();\n $oDaoBens->t52_numcgm = $this->getFornecedor()->getCodigo();\n $oDaoBens->t52_obs = $this->getObservacao();\n $oDaoBens->t52_valaqu = \"{$this->getValorAquisicao()}\";\n\n /**\n * Inclusao - busca placa\n */\n if (empty($this->iCodigoBem)) {\n $oDaoBens->t52_ident = $this->getPlaca()->getNumeroPlaca();\n }\n\n $lIncorporacaoBem = false;\n if (!empty($this->iCodigoBem)) {\n\n $oDaoBens->t52_bem = $this->iCodigoBem;\n $oDaoBens->alterar($this->iCodigoBem);\n $sHistoricoBem = 'Alteração de dados do Bem';\n } else {\n\n $sHistoricoBem = 'Inclusão do Bem';\n $oDaoBens->incluir(null);\n $this->iCodigoBem = $oDaoBens->t52_bem;\n $lIncorporacaoBem = true;\n }\n\n if ($oDaoBens->erro_status == 0) {\n throw new Exception(_M('patrimonial.patrimonio.Bem.erro_salvar', (object)array(\"erro_msg\" => $oDaoBens->erro_msg)));\n }\n\n $lRealizarEscrituracao = $this->criaVinculoBemNotas();\n\n $oDataAtual = new DBDate(date('Y-m-d', db_getsession(\"DB_datausu\")));\n $oInstit = new Instituicao(db_getsession(\"DB_instit\"));\n $lIntegracaoFinanceiro = ParametroIntegracaoPatrimonial::possuiIntegracaoPatrimonio($oDataAtual, $oInstit);\n\n $lRealizouLancamento = false;\n if ($lRealizarEscrituracao && $lIntegracaoFinanceiro && $lIncorporacaoBem) {\n $lRealizouLancamento = $this->processaLancamentoContabil();\n }\n\n /**\n * Salva os dados da depreciacao do bem\n */\n $this->salvarDepreciacao();\n\n $this->oPlaca->setCodigoBem($this->iCodigoBem);\n $this->oPlaca->salvar();\n\n /**\n * Salvamos o Historico do bem\n */\n $oHistoricoBem = new BemHistoricoMovimentacao();\n $oHistoricoBem->setData(date(\"Y-m-d\", db_getsession(\"DB_datausu\")));\n $oHistoricoBem->setDepartamento(db_getsession(\"DB_coddepto\"));\n $oHistoricoBem->setHistorico($sHistoricoBem);\n $oHistoricoBem->setCodigoSituacao($this->getSituacaoBem());\n $oHistoricoBem->salvar($this->iCodigoBem);\n\n $this->salvarDadosDivisao();\n $this->salvarDadosCedente();\n if ($this->getDadosImovel() instanceof BemDadosImovel) {\n\n $this->getDadosImovel()->setBem($this->iCodigoBem);\n $this->getDadosImovel()->salvar();\n }\n\n if ($this->getDadosCompra() instanceof BemDadosMaterial) {\n\n $this->getDadosCompra()->setBem($this->iCodigoBem);\n $this->getDadosCompra()->salvar();\n }\n\n if ($this->getTipoAquisicao() instanceof BemTipoAquisicao) {\n /**\n * Só executa se bem for uma inclusão manual ($lRealizouLancamento == false)\n */\n \tif ($lIncorporacaoBem == true && !$lRealizouLancamento && USE_PCASP && $lIntegracaoFinanceiro) {\n\n $oLancamentoauxiliarBem = new LancamentoAuxiliarBem();\n $oEventoContabil = new EventoContabil(700, db_getsession('DB_anousu'));\n $oLancamentoauxiliarBem->setValorTotal($this->getValorAquisicao());\n $oLancamentoauxiliarBem->setBem($this);\n $oLancamentoauxiliarBem->setObservacaoHistorico(\"{$this->getObservacao()} | Código do Bem: {$this->iCodigoBem}.\");\n\n $aLancamentos = $oEventoContabil->getEventoContabilLancamento();\n $oLancamentoauxiliarBem->setHistorico($aLancamentos[0]->getHistorico());\n $oEventoContabil->executaLancamento($oLancamentoauxiliarBem);\n \t}\n }\n }", "function buscarUtlimaSalidaDAO(){\n $conexion = Conexion::crearConexion();\n try {\n $conexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n $stm = $conexion->prepare(\"SELECT * FROM salidas ORDER BY id_venta DESC LIMIT 1\");\n $stm->execute();\n $exito = $stm->fetch();\n } catch (Exception $ex) {\n throw new Exception(\"Error al buscar la ultima salida en bd\");\n }\n return $exito;\n }", "public function costo_bancos($proceso) {\n\n $sql = \"SELECT * from bancos where status = 'A' and nombre like '%\" . $proceso . \"%' limit 1\";\n\n $query = $this->db->prepare($sql);\n $query->execute();\n\n $result = array();\n\n while ($row = $query->fetch(PDO::FETCH_ASSOC)) {\n\n $result[] = $row;\n }\n\n return $result;\n }", "public function testSaldoDeRecursosExtraOrcamentariosIgualAoSaldoDoPassivoARecolherMenosOAtivoACompensarDeduzidosDosSequestros() {\n $filter = function (array $line): bool {\n if (\n str_starts_with($line['conta_contabil'], '1.1.1.1.1.') && $line['escrituracao'] === 'S' && $line['recurso_vinculado'] >= 8000 && $line['recurso_vinculado'] <= 8999\n ) {\n return true;\n }\n return false;\n };\n $saldoDevedorDisp = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_debito', $filter);\n $saldoCredorDisp = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_credito', $filter);\n\n $filter = function (array $line): bool {\n if (\n (\n str_starts_with($line['conta_contabil'], '1.') && !str_starts_with($line['conta_contabil'], '1.1.1.1.1.')\n ) && $line['escrituracao'] === 'S' && $line['recurso_vinculado'] >= 8000 && $line['recurso_vinculado'] <= 8999\n ) {\n return true;\n }\n return false;\n };\n $saldoDevedorAtivo = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_debito', $filter);\n $saldoCredorAtivo = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_credito', $filter);\n\n $filter = function (array $line): bool {\n if (\n str_starts_with($line['conta_contabil'], '1.1.3.5.1.05.') && $line['escrituracao'] === 'S') {\n return true;\n }\n return false;\n };\n $saldoDevedorAtivoSequestro = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_debito', $filter);\n $saldoCredorAtivoSequestro = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_credito', $filter);\n\n $filter = function (array $line): bool {\n if (\n str_starts_with($line['conta_contabil'], '2.') && $line['escrituracao'] === 'S' && $line['recurso_vinculado'] >= 8000 && $line['recurso_vinculado'] <= 8999\n ) {\n return true;\n }\n return false;\n };\n $saldoDevedorPassivo = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_debito', $filter);\n $saldoCredorPassivo = $this->somaColuna($this->getDataFrame('BAL_VER'), 'saldo_atual_credito', $filter);\n\n $this->comparar(($saldoDevedorDisp - $saldoCredorDisp) + ($saldoDevedorAtivoSequestro - $saldoCredorAtivoSequestro), ($saldoCredorPassivo - $saldoDevedorPassivo) - ($saldoDevedorAtivo - $saldoCredorAtivo));\n }", "public function indexListaSobrantes($id){\n // viene id de ingreso_b3\n\n $dataArray = array();\n\n $listado = IngresosDetalleB3::where('id_ingresos_b3', $id)->orderBy('nombre')->get();\n\n foreach ($listado as $l){\n\n // obtener cantidad verificada\n $listave = VerificadoIngresoDetalleB3::where('id_ingresos_detalle_b3', $l->id)->get();\n $totalve = collect($listave)->sum('cantidad');\n $l->cantiverificada = $totalve;\n\n // obtener cantidad retirada\n $listare = RetiroBodegaDetalleB3::where('id_ingresos_detalle_b3', $l->id)->get();\n $totalre = collect($listare)->sum('cantidad');\n $l->cantiretirada = $totalre;\n\n $resta = $totalve - $totalre;\n // $l->sobrante = $resta;\n\n if($rem = RegistroExtraMaterialDetalleB3::where('id_ingresos_detalle_b3', $l->id)->first()){\n // si lo encuentra es un material extra agregado\n // obtener fecha cuando se agrego\n\n $infodeta = RegistroExtraMaterialB3::where('id', $rem->id_reg_ex_mate_b3)->first();\n\n // meter la fecha\n $fecha = date(\"d-m-Y\", strtotime($infodeta->fecha));\n\n $dataArray[] = [\n 'fecha' => $fecha,\n 'nombre' => $l->nombre,\n 'preciounitario' => $l->preciounitario,\n 'cantidad' => $l->cantidad,\n 'cantiverificada' => $totalve,\n 'cantiretirada' => $totalre,\n 'sobrante' => $resta\n ];\n\n }else{\n // es un material agregado al crear el proyecto\n $daa = IngresosB3::where('id', $l->id_ingresos_b3)->first();\n\n $fecha = date(\"d-m-Y\", strtotime($daa->fecha));\n\n $dataArray[] = [\n 'fecha' => $fecha,\n 'nombre' => $l->nombre,\n 'preciounitario' => $l->preciounitario,\n 'cantidad' => $l->cantidad,\n 'cantiverificada' => $totalve,\n 'cantiretirada' => $totalre,\n 'sobrante' => $resta\n ];\n }\n }\n\n // metodos para ordenar el array\n usort($dataArray, array( $this, 'sortDate' ));\n\n return view('backend.bodega3.verificacion.sobrante.index', compact('dataArray'));\n }", "static Public function MdlMostrarSalidas($tabla, $campo, $valor, $fechaSel){\n\n$where='1=1';\n\n$idtec = (int) $valor;\n$where.=($idtec>0)? ' AND id_cliente=\"'.$idtec.'\" ' : \"\";\n\n$tabla = (int) $tabla;\n$where.=($tabla>0)? ' AND id_almacen=\"'.$tabla.'\"' : \"\";\n\n$where.=(!empty($fechaSel))? ' AND fecha_salida=\"'.$fechaSel.'\"' : \"\";\n\n$where.=' GROUP by num_salida,fecha_salida,id_almacen,id_cliente';\n\nif($tabla>0 || $idtec>0 || !empty($fechaSel)){\t\t\t//QUE ALMACEN MOSTRAR SALIDAS\n\t$sql=\"SELECT `id_cliente`, t.nombre AS nombrecliente, `num_salida`, `fecha_salida`, SUM(`cantidad`) AS salio, \n\tSUM(IF(`es_promo` = 0, `cantidad`*`precio_venta`,0)) AS sinpromo, \n\tSUM(IF(`es_promo` = 1, `precio_venta`,0)) AS promo, id_tipovta,\n\t`id_almacen`,a.nombre AS almacen FROM `hist_salidas` INNER JOIN clientes t ON id_cliente=t.id \n\tINNER JOIN almacenes a ON id_almacen=a.id WHERE \".$where;\n\t\n}else{ // TODOS LOS ALMACENES\n\n\t$sql=\"SELECT `id_cliente`, t.nombre AS nombrecliente, `num_salida`, `fecha_salida`, SUM(`cantidad`) AS salio, id_tipovta, `id_almacen`,a.nombre AS almacen FROM `hist_salidas` INNER JOIN clientes t ON id_cliente=t.id \n\tINNER JOIN almacenes a ON id_almacen=a.id\n\tGROUP by `num_salida`,`fecha_salida`,`id_almacen`,`id_cliente`\";\n}\n\n $stmt=Conexion::conectar()->prepare($sql);\n\t\t\n //$stmt->bindParam(\":\".$campo, $valor, PDO::PARAM_STR);\n \n if($stmt->execute()){;\n \n return $stmt->fetchAll();\n \n //if ( $stmt->rowCount() > 0 ) { do something here }\n \n \t }else{\n\n\t\t\treturn false;\n\n\t } \n \n \n $stmt=null;\n }", "function s_d_salarii_platit()\n{\n // selecteaza datele platite deja din salarii\n $submission_date = format_data_out_db('submission_date');\n $query_sal = \"SELECT DISTINCT $submission_date AS date_db\n FROM cozagro_db.work_days \n WHERE work_days.deleted = 0 AND completed = 0\n ORDER BY submission_date DESC \";\n $result_sal = Database::getInstance()->getConnection()->query($query_sal);\n if (!$result_sal) {\n die(\"Nu s-a reusit conexiunea la DB selectarea salariilor platite\" . Database::getInstance()->getConnection()->error);\n }\n $salary = [];\n while ($sal = $result_sal->fetch_assoc()) {\n $salary[] = [remove_day_from_date_and_format($sal['date_db']), translate_date_to_ro($sal['date_db'])];\n }\n $result_sal->free_result();\n return $salary;\n}", "public function salvar()\n {\n $data = Input::all();\n $contato = Contato::newInstance($data);\n $contato = $this->contatoBO->salvar($contato);\n\n return $this->toJson($contato);\n }", "public function salvar() {\n\n if (!db_utils::inTransaction()) {\n throw new Exception(_M('patrimonial.patrimonio.PlanilhaCalculo.nao_existe_transacao'));\n }\n if (count($this->getCalculos()) == 0) {\n throw new Exception(_M('patrimonial.patrimonio.PlanilhaCalculo.planilha_sem_calculos'));\n }\n\n if (empty($this->iMes)) {\n throw new Exception(_M('patrimonial.patrimonio.PlanilhaCalculo.planilha_sem_mes_de_processamento'));\n }\n\n if (empty($this->iAno)) {\n throw new Exception(_M('patrimonial.patrimonio.PlanilhaCalculo.planilha_sem_ano_de_processamento'));\n }\n $oDaoBensHistoricoCalculo = db_utils::getDao(\"benshistoricocalculo\");\n $oDaoBensHistoricoCalculo->t57_ano = $this->getAno();\n $oDaoBensHistoricoCalculo->t57_mes = $this->getMes();\n $oDaoBensHistoricoCalculo->t57_ativo = $this->isAtiva()?\"true\":\"false\";\n $oDaoBensHistoricoCalculo->t57_datacalculo = date(\"Y-m-d\", db_getsession(\"DB_datausu\"));\n $oDaoBensHistoricoCalculo->t57_instituicao = db_getsession(\"DB_instit\");\n $oDaoBensHistoricoCalculo->t57_processado = $this->isProcessado()?\"true\":\"false\";\n $oDaoBensHistoricoCalculo->t57_tipocalculo = $this->getTipoCalculo();\n $oDaoBensHistoricoCalculo->t57_tipoprocessamento = $this->getTipoProcessamento();\n $oDaoBensHistoricoCalculo->t57_usuario = db_getsession(\"DB_id_usuario\");\n if (empty($this->iPlanilha)) {\n\n $oDaoBensHistoricoCalculo->incluir(null);\n $this->iPlanilha = $oDaoBensHistoricoCalculo->t57_sequencial;\n\n /**\n * Salvamos os dados dos calculos na planilha\n */\n $aCalculos = $this->getCalculos();\n foreach ($aCalculos as $oCalculo) {\n $oCalculo->salvar($this->iPlanilha);\n }\n } else {\n\n $oDaoBensHistoricoCalculo->t57_sequencial = $this->iPlanilha;\n $oDaoBensHistoricoCalculo->alterar($this->iPlanilha);\n }\n\n if ($oDaoBensHistoricoCalculo->erro_status == 0) {\n throw new Exception(_M('patrimonial.patrimonio.PlanilhaCalculo.planilha_sem_ano_de_processamento',$oDaoBensHistoricoCalculo));\n }\n }", "public function getSalutations()\n {\n $salutations = ['', 'Mr.', 'Ms.', 'Dr.', 'Rev.', 'Prof.'];\n\n return array_combine($salutations, $salutations);\n }", "public function salvarDepreciacao() {\n\n $oDaoBensDepreciacao = new cl_bensdepreciacao();\n $oDaoBensDepreciacao->t44_benstipoaquisicao = $this->getTipoAquisicao()->getCodigo();\n $oDaoBensDepreciacao->t44_benstipodepreciacao = $this->getTipoDepreciacao()->getCodigo();\n $oDaoBensDepreciacao->t44_valoratual = \"{$this->getValorDepreciavel()}\";\n $oDaoBensDepreciacao->t44_valorresidual = \"{$this->getValorResidual()}\";\n $oDaoBensDepreciacao->t44_vidautil = \"{$this->getVidaUtil()}\";\n\n if (!empty($this->iCodigoBemDepreciacao)) {\n\n $oDaoBensDepreciacao->t44_sequencial = $this->iCodigoBemDepreciacao;\n $oDaoBensDepreciacao->alterar($this->iCodigoBemDepreciacao);\n\n } else {\n\n $oDaoBensDepreciacao->t44_ultimaavaliacao = date(\"Y-m-d\", db_getsession(\"DB_datausu\"));\n $oDaoBensDepreciacao->t44_bens = $this->iCodigoBem;\n $oDaoBensDepreciacao->incluir(null);\n $this->iCodigoBemDepreciacao = $oDaoBensDepreciacao->t44_sequencial;\n }\n\n if ($oDaoBensDepreciacao->erro_status == \"0\") {\n $sMsg = _M('patrimonial.patrimonio.Bem.erro_salvar_calculo', (object)array(\"erro_msg\" => $oDaoBensDepreciacao->erro_msg));\n throw new Exception($sMsg);\n }\n return true;\n }", "public function saldoExist($insumos){\n\n\t\t$errores = [];\n\n\t \tforeach ($insumos as $key => $insumo){\n\n\t \t\tif(!isset($insumo['lote']) || empty($insumo['lote']))\n\t \t\t\tcontinue;\n\n\t \t\t$loteRegister = Lote::where('insumo', $insumo['id'])\n\t\t\t\t\t\t \t->where('codigo', $insumo['lote'])\n\t\t\t\t\t\t \t->where('deposito', Auth::user()->deposito)\n\t\t\t\t\t\t \t->orderBy('id', 'desc')\n\t\t\t\t\t\t \t->first();\n\n if( ($loteRegister->cantidad - $insumo['despachado']) < 0){\n array_push($errores, ['insumo' => $insumo['id'], 'lote' => $insumo['lote']]);\n }\n }\n\n\t return $errores;\n\t}", "public function testSaldo() {\n $tiempo = new TiempoFalso();\n $tarjeta = new Tarjeta( $tiempo );\n $tarjeta->recargar(100.0);\n $saldo=100.0;\n $boleto = new Boleto(NULL, NULL, $tarjeta, NULL, NULL, NULL, NULL, NULL, NULL);\n\n $this->assertEquals($boleto->obtenersaldo(), $saldo);\n }", "public function getAll(){\r\n $sql=\"SELECT * FROM salas\";\r\n try{\r\n //creo la instancia de conexion\r\n $this->connection= Connection::getInstance();\r\n $result = $this->connection->execute($sql);\r\n }catch(\\PDOException $ex){\r\n throw $ex;\r\n } \r\n //hay que mapear de un arreglo asociativo a objetos\r\n if(!empty($result)){\r\n return $this->mapeo($result);\r\n }else{\r\n return false;\r\n }\r\n\r\n }" ]
[ "0.69366264", "0.6667662", "0.6523915", "0.63235855", "0.63079447", "0.6089488", "0.60707694", "0.6013067", "0.5995885", "0.5995085", "0.5968853", "0.59546", "0.59546", "0.58985096", "0.58831257", "0.5863881", "0.58619416", "0.58089036", "0.5788279", "0.5738757", "0.5696751", "0.56796384", "0.56448686", "0.5636843", "0.5625235", "0.56173587", "0.56167424", "0.56149095", "0.56069833", "0.5605612" ]
0.8077642
0
construcrs a new BaseModel
public function __construct() { $this->model = new BaseModel; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __construc()\r\n\t{\r\n\t\tparent::Model();\r\n\t}", "function __construct()\n {\n // 呼叫模型(Model)的建構函數\n parent::__construct();\n \n }", "function __construct()\r\n {\r\n parent::Model();\r\n }", "function __construct() {\r\n parent::Model();\r\n }", "function __construct()\n {\n parent::Model();\n }", "protected function createBaseModel()\n {\n $name = $this->qualifyClass('Model');\n $path = $this->getPath($name);\n\n if (!$this->files->exists($path)) {\n $this->files->put(\n $path,\n $this->files->get(__DIR__.'/../../stubs/model.base.stub')\n );\n }\n }", "public function __construct()\n {\n parent::Model();\n\n }", "public function __construct()\n {\n $this ->model = $this ->makeModel($this ->model());\n }", "abstract protected function newModel(): Model;", "function __construct () {\n\t\t$this->_model = new Model();\n\t}", "public function __construct() {\n parent::__construct();\n $this->load->model(\"modelo_base\");\n \n }", "public function __construct() {\n // Call the Model constructor\n parent::__construct();\n }", "function __construct()\n {\n // Call the Model constructor\n parent::__construct();\n }", "function __construct()\n {\n // Call the Model constructor\n parent::__construct();\n }", "function __construct()\n {\n // Call the Model constructor\n parent::__construct();\n }", "function __construct()\n {\n // Call the Model constructor\n parent::__construct();\n }", "function __construct() {\n // Call the Model constructor \n parent::__construct();\n }", "public function __construct(Model $model) {\n parent::__construct($model);\n \n }", "function __construct(){\n\t\tparent::__construct();\n\t\t\t$this->set_model();\n\t}", "public function __construct($model) \n {\n parent::__construct($model);\n }", "public function __construct() {\n parent::__construct();\n $this->load->database();\n $this->load->model(\"base_model\");\n }", "public function __construct()\n {\n parent::__construct('testutils\\mvvm\\TestModel');\n }", "public function __construct(){\n\t\tparent::__construct();\n\t\t$this->load->model('Model');\n\t}", "public function __construct(){\n\t\tparent::__construct();\n\t\t$this->load->model('Model');\n\t}", "function __construct()\n {\n parent::__construct();\n\n //Load model con nombre base\n $this->load->model('Crud_model', 'Rest_model');\n }", "public function __construct()\n {\n \t parent::__construct();\n \t $this->load->model('Modelo');\n }", "public function __construct()\n {\n // Call the CI_Model constructor\n parent::__construct();\n }", "public function __construct()\n {\n // Call the CI_Model constructor\n parent::__construct();\n }", "public function __construct(){\n\n\t\t$this->types_model = new Types();\n\t}", "private function __construct($model)\r\n {\r\n\r\n }" ]
[ "0.78787273", "0.7385974", "0.73807234", "0.73535955", "0.72769177", "0.72418636", "0.7142186", "0.7119367", "0.709172", "0.70602024", "0.7030872", "0.7000855", "0.69489264", "0.69489264", "0.69489264", "0.69489264", "0.69463074", "0.6916801", "0.6860955", "0.6841091", "0.67299724", "0.66861135", "0.6663715", "0.6663715", "0.6653084", "0.6609644", "0.6604376", "0.6604376", "0.65893847", "0.6588652" ]
0.8086582
0
Creates a chdb file
function chdb_create($pathname, $data) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDatabase() {\n try {\n $pdoObject = new PDOObject();\n $pdoObject->createTables();\n $pdo = $pdoObject->getPDO();\n\n openFile($pdo);\n } catch (PDOException $e) {\n $e->getMessage();\n exit;\n } finally {\n unset($pdo);\n }\n}", "public function storeFile()\n\t{\n\t\tif (!$this->blnIsModified)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$strFile = trim($this->strTop) . \"\\n\\n\";\n\t\t$strFile .= \"-- LESSON SEGMENT START --\\nCREATE TABLE `tl_cb_lessonsegment` (\\n\";\n\n\t\tforeach ($this->arrData as $k=>$v)\n\t\t{\n\t\t\t$strFile .= \" `$k` $v,\\n\";\n\t\t}\n\n\t\t$strFile .= \") ENGINE=MyISAM DEFAULT CHARSET=utf8;\\n-- LESSON SEGMENT STOP --\\n\\n\";\n\n\t\tif ($this->strBottom != '')\n\t\t{\n\t\t\t$strFile .= trim($this->strBottom) . \"\\n\\n\";\n\t\t}\n\n\t\t$objFile = new File('system/modules/course_builder/config/database.sql');\n\t\t$objFile->write($strFile);\n\t\t$objFile->close();\n\t}", "public function create() {\n\t\t$db = ConnectionManager::getDataSource('default');\n\t\t$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];\n\t\t$file = $this->_path() . 'dbdump_' . date(\"Y-m-d--H-i-s\");\n\n\t\t$options = array(\n\t\t\t'--user=' . $db->config['login'],\n\t\t\t'--password=' . $db->config['password'],\n\t\t\t'--default-character-set=' . $db->config['encoding'],\n\t\t\t'--host=' . $db->config['host'],\n\t\t\t'--databases ' . $db->config['database'],\n\t\t);\n\t\t$sources = $db->listSources();\n\t\tif (array_key_exists('tables', $this->params) && empty($this->params['tables'])) {\n\t\t\t// prompt for tables\n\t\t\tforeach ($sources as $key => $source) {\n\t\t\t\t$this->out('[' . $key . '] ' . $source);\n\t\t\t}\n\t\t\t$tables = $this->in('What tables (separated by comma without spaces)', null, null);\n\t\t\t$tables = explode(',', $tables);\n\t\t\t$tableList = array();\n\t\t\tforeach ($tables as $table) {\n\t\t\t\tif (isset($sources[intval($table)])) {\n\t\t\t\t\t$tableList[] = $sources[intval($table)];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$options[] = '--tables ' . implode(' ', $tableList);\n\t\t\t$file .= '_custom';\n\n\t\t} elseif (!empty($this->params['tables'])) {\n\t\t\t$sources = explode(',', $this->params['tables']);\n\t\t\tforeach ($sources as $key => $val) {\n\t\t\t\t$sources[$key] = $usePrefix . $val;\n\t\t\t}\n\t\t\t$options[] = '--tables ' . implode(' ', $sources);\n\t\t\t$file .= '_custom';\n\t\t} elseif ($usePrefix) {\n\t\t\tforeach ($sources as $key => $source) {\n\t\t\t\tif (strpos($source, $usePrefix) !== 0) {\n\t\t\t\t\tunset($sources[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$options[] = '--tables ' . implode(' ', $sources);\n\t\t\t$file .= '_' . rtrim($usePrefix, '_');\n\t\t}\n\t\t$file .= '.sql';\n\t\tif (!empty($this->params['compress'])) {\n\t\t\t$options[] = '| gzip';\n\t\t\t$file .= '.gz';\n\t\t}\n\t\t$options[] = '> ' . $file;\n\n\t\t$this->out('Backup will be written to:');\n\t\t$this->out(' - ' . $this->_path());\n\t\t$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');\n\t\tif ($looksGood !== 'y') {\n\t\t\treturn $this->error('Aborted!');\n\t\t}\n\n\t\tif ($this->_create($options)) {\n\t\t\t$this->out('Done :)');\n\t\t}\n\t}", "function create_database() \r\n {\r\n \t\t\t$this->tx_cbywebdav_devlog(1,\"create_database\",\"cby_webdav\",\"create_database\");\r\n\r\n // TODO\r\n return false;\r\n }", "private function make()\n {\n \n $file = database_path().'/migrations/'.$this->fileName.'.php';\n \n $content = $this->blueprint();\n \n $this->file_write( $file, $content );\n \n }", "public function create(string $database, string $file, array $params): void;", "public function createMySqlFile($arg) \n\t{\n\t\t$str = \"\";\n\t\t$str .= \"<?php\\n namespace lib\\database;\\n class Connection extends Clauses\\n {\\n\";\n\t\t$str .= \"protected \\$conn; \\n\";\n\t\t$str .= \"private \\$hosts = '\".$arg['database']['host'].\"'; \\n\";\n\t\t$str .= \"private \\$dbname = '\".$arg['database']['db'].\"'; \\n\";\n\t\t$str .= \"private \\$user = '\".$arg['database']['user'].\"'; \\n\";\n\t\t$str .= \"private \\$pass = '\".$arg['database']['pass'].\"'; \\n\";\n\t\t$str .= \"function __construct()\\n{\\n\";\n\t\t$str .=\"try {\\n\";\n\t\t$str .=\"\\t\\$this->conn = new \\PDO('mysql:host='.\\$this->hosts.';dbname='.\\$this->dbname,\n\t\t\t\t\\t\\$this->user,\\$this->pass);\\n\";\n\t\t$str .=\"} catch (\\PDOException \\$e) {\\n\";\n\t\t$str .=\"\\treturn \\$e->getMessage();\\n\";\n\t\t$str .=\"}\\n\";\n\t\t$str .=\"}\\n\";\n\t\t$str .=\"}\\n\";\n\t\treturn $str;\n\t}", "private function make_db() {\n ee()->load->dbforge();\n $fields = array(\n 'id' => array('type' => 'varchar', 'constraint' => '32'),\n 'access' => array('type' => 'integer', 'constraint' => '10', 'unsigned' => true),\n 'data' => array('type' => 'text')\n );\n ee()->dbforge->add_field($fields);\n ee()->dbforge->add_key('id', true);\n ee()->dbforge->create_table($this->table_name);\n\n return true;\n }", "public function create()\n {\n $db = XenForo_Application::get('db');\n $db->query('CREATE TABLE `' . self::DB_TABLE . '`\n (`threema_id` CHAR(8) NOT NULL PRIMARY KEY,\n `public_key` CHAR(64) NOT NULL)\n ');\n }", "protected function createFile() {}", "public function makeDbDumps()\n {\n foreach ($this->dbKeys as $key) {\n $file = \\yii::getAlias('@storage') . '/backup/dump-' . $key . time() . '.sql';\n $command = $this->extractCommandFromParams($key, $file);\n\n $this->stdout($command . ' \\n ');\n exec($command);\n\n $this->dumpFiles[] = $file;\n $this->folders[] = $file;\n }\n }", "function createTable() {\n print \"\\nCreate table: \".$dbtable.\"\\n\";\n if (createDB()) {\n print \"OK\\n\";\n }\n interceptExit();\n }", "private function auto_create(){\n\n if ( $this->firebug ) \\FB::info(get_called_class().\": auto creating file\");\n\n $root = $this->use_codeza_root ? (string)new Code_Alchemy_Root_Path() : '';\n\n $filename = $root . $this->template_file;\n\n if ( file_exists($filename) && ! file_exists($this->file_path)) {\n\n $copier = new Smart_File_Copier($filename,$this->file_path,$this->string_replacements,false);\n\n $copier->copy();\n\n }\n\n\n\n }", "protected function createDatabaseStructure() {}", "function CreateDB() {\n $sql = \"CREATE SCHEMA IF NOT EXISTS `mydb`\" .\n \"DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;\";\n performSQL($sql);\n}", "function writeData($db, $cnumber, $ctype, $cvv, $cname)\n\t\t\t\t\t{\n\t\t\t\t\t\t$cid = substr($cnumber, 0, 3).$ctype.$cvv;\n\t\t\t\t\t\t$stmt = $db->prepare(\"INSERT INTO businessTransaction (number, type, cvv, name, cid) VALUES (:cnumber,:ctype,:cvv,:cname,:cid)\");\n\t\t\t\t\t\t$stmt->execute(array(':cnumber' => \"$cnumber\", ':ctype' => \"$ctype\", ':cvv' => \"$cvv\", ':cname' => \"$cname\", ':cid' => $cid));\n\t\t\t\t\t}", "public function createDatabase($name, $charSet = null) {\t\tthrow new RuntimeException(\n\t\t\t\"Creating SQLite databases is not currently supported\"\n\t\t);\n\t}", "private static function setupDB() {\n\t\t$tbl = self::$table;\n\t\t$dbw = wfGetDB( DB_MASTER );\n\t\twfDebugLog( __METHOD__, \"\\tCreating tables\\n\" );\n\t\t$dbw->query(\n\t\t\t\"CREATE TABLE IF NOT EXISTS $tbl ( pathway varchar(255), day varchar(50) )\", DB_MASTER\n\t\t);\n\t\twfDebugLog( __METHOD__, \"\\tDone!\\n\" );\n\t}", "function wb_create_database($db_name, $con)\n{ \n\tif( !mysql_query(\"CREATE DATABASE IF NOT EXISTS $db_name\", $con) )\n\t\tdie( 'Could not create database: ' . mysql_error() );\n\tif( !mysql_select_db($db_name, $con) )\n\t\tdie( 'Could not select database: ' . mysql_error() );\n\t\n\twb_create_sitemap_table($con);\n\twb_create_content_table($con);\n\twb_create_users_table($con);\n\twb_create_permissions_table($con);\n\twb_create_comments_table($con);\n}", "protected function createDatabase()\n {\n\n $databaseFileName = strtolower(str::plural($this->moduleName));\n\n // Create Schema only in monogo database\n $databaseDriver = config('database.default');\n if ($databaseDriver == 'mongodb') {\n $this->createSchema($databaseFileName);\n }\n }", "private function setupDatabase($database) {\n\n\t\t// Check database directory\n\t\t$dir = rtrim($this->options['dir'], '/\\\\') . DIRECTORY_SEPARATOR;\n\n\t\tif (!is_dir($dir)) {\n\t\t\tthrow new FlintstoneException($dir . ' is not a valid directory');\n\t\t}\n\n\t\t// Set data\n\t\t$ext = $this->options['ext'];\n\t\tif (substr($ext, 0, 1) !== \".\") $ext = \".\" . $ext;\n\t\tif ($this->options['gzip'] === true && substr($ext, -3) !== \".gz\") $ext .= \".gz\";\n\t\t$this->data['file'] = $dir . $database . $ext;\n\t\t$this->data['file_tmp'] = $dir . $database . \"_tmp\" . $ext;\n\t\t$this->data['cache'] = array();\n\n\t\t// Create database file\n\t\tif (!file_exists($this->data['file'])) {\n\t\t\t$this->createFile($this->data['file']);\n\t\t}\n\n\t\t// Check file is readable\n\t\tif (!is_readable($this->data['file'])) {\n\t\t\tthrow new FlintstoneException('Could not read file ' . $this->data['file']);\n\t\t}\n\n\t\t// Check file is writable\n\t\tif (!is_writable($this->data['file'])) {\n\t\t\tthrow new FlintstoneException('Could not write to file ' . $this->data['file']);\n\t\t}\n\t}", "public function prepareDatabase()\n {\n // If SQLite database does not exist, create it\n if ($this->config->database['connection'] === 'sqlite') {\n $path = $this->config->database['database'];\n if ( ! $this->fileExists($path) && is_dir(dirname($path))) {\n $this->write(\"Creating $path ...\");\n touch($path);\n }\n }\n }", "public function cr_database( $db_name )\n\t{\n\t\t// SQL String: CREATE DATABASE IF NOT EXISTS Library;\n\t\t$this->dbforge->create_database($db_name, TRUE);\n\t}", "function createDistributedDB($host, $name, $user='root', $password='', $sqlfile) {\n $dbobj = new DBObj($host, 'information_schema', $user, $password);\n\n if($res = $dbobj->query(\"select * from SCHEMATA where SCHEMA_NAME='$name'\")) {\n if($record = $dbobj->fetch_assoc($res)) {\n //echo \"$name already exists, no need to be created\\n\";\n return true;\n }\n }\n\n // start createing user_history_stat schema\n $sql = \"create database $name\";\n //echo \"createUserHistoryStatDB sql: $sql\\n\";\n if(!$dbobj->query($sql)) {\n return false;\n }\n $script_str = \"mysql -h $host -u$user \";\n if(!empty($password)){\n \t$script_str .= \"-p$password\";\n }\n\n $script_str .= \" $name\";\n $script_str = \"/usr/bin/php \" . __DIR__ . \"/../scripts/mustachize.php \" . __DIR__ . \"/../configs/$sqlfile | $script_str\";\n exec($script_str);\n\n //echo \"exec: \".\"mysql -h $host -u$user $name < \".__DIR__.\"/../configs/user_history_stat.sql\\n\";\n return true;\n}", "function ccio_appendData($filename, $data) {\r\n\t//$fh = fopen($filename, \"ab\");\r\n\t$fh = fopen($filename, \"at\");\r\n\tfwrite($fh, $data);\t\t\r\n\tfclose($fh);\r\n\treturn TRUE;\r\n}", "protected function createCacheFile()\n {\n $this->createCacheDir();\n\n $cacheFilePath = $this->getCacheFile();\n\n if ( ! file_exists($cacheFilePath)) {\n touch($cacheFilePath);\n }\n }", "private function createFile($filename, $content){\n\tfile_put_contents($filename.\".gz\", gzencode($content, 9)) or die(\"\\nCannot write file \".$filename);\t \n\techo \"\\nFilename \" . $filename . \" was successfully written\\n\";\n }", "function loadFileFromDB() {\n\t\t// If file contents are in bin_data column, fetch data and store in file.\n\t\tif (isset($this->data_array[\"bin_data\"]) && \n\t\t\ttrim($this->data_array[\"bin_data\"]) != \"\") {\n\n\t\t\t// Need to decode the string first.\n\t\t\t$theFileContent = base64_decode($this->data_array[\"bin_data\"]);\n\n\t\t\t$theDir = dirname($this->getFile());\n\t\t\tif (!file_exists($theDir)) {\n\t\t\t\t// Its parent directory does not exist yet. Create it.\n\t\t\t\tmkdir($theDir);\n\t\t\t}\n\n\t\t\t// Create the file for future use.\n\t\t\t$fp = fopen($this->getFile(), \"w+\");\n\t\t\tfwrite($fp, $theFileContent);\n\t\t\tfclose($fp);\n\t\t}\n\t}", "private static function createTestChatDB()\n {\n $logger = new APILogger();\n\n $logger->debug(\"Creating TestChatDB.\", null);\n\n $testChatDB = new PDO('sqlite::memory:');\n\n if($testChatDB == null)\n {\n throw new PhavaException(\"Creating in-memory database failed!\");\n }\n\n $logger->info(\"Created in-memory database.\",null);\n\n $sql = file_get_contents(\"/app/init.sql\");\n\n if ($testChatDB->exec($sql) != false){\n $logger->info(\"In-memory database ready.\",null);\n self::$testChatDB = $testChatDB;\n }\n else {\n $logger->info(\"Failed to initialize in-memory database.\",null);\n }\n }", "private function createMainDatabaseRecords()\n {\n // get the .sql file\n $sql = (string) @file_get_contents( $this->plugin->getPath() . \"/Setup/install.sql\" );\n\n // insert it\n $this->db->exec( $sql );\n }" ]
[ "0.5789226", "0.57887864", "0.5714959", "0.56003565", "0.5486891", "0.528351", "0.51988626", "0.5155052", "0.51373464", "0.5117194", "0.51164925", "0.5095568", "0.5058783", "0.5050832", "0.5025576", "0.50233716", "0.5008117", "0.50074255", "0.4994682", "0.49878117", "0.49682367", "0.49340189", "0.4913365", "0.490913", "0.48952484", "0.48862544", "0.48858005", "0.48682696", "0.48639783", "0.4846584" ]
0.6863739
0
Creates a base32 secret key of 16 chars length.
public static function generateSecretKey() : string { $secretKey = ''; for ($i = 0; $i < 16; $i++) $secretKey .= self::CHARSET[random_int(0, 31)]; return $secretKey; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function create_secret($secret_length = 16)\n {\n $valid_chars = self::_get_base32_lookup_table();\n unset($valid_chars[32]);\n\n $secret = '';\n for ($i = 0; $i < $secret_length; $i++) \n {\n $secret .= $valid_chars[array_rand($valid_chars)];\n }\n return $secret;\n }", "abstract public function createSecretKey();", "public static function generateSecret() {\n\n\t\t$secretLength = self::SECRET_LENGTH;\n\n\t\t// Valid secret lengths are 80 to 640 bits\n\t\tif ($secretLength < 16 || $secretLength > 128) {\n\t\t\tthrow new \\Exception('Bad secret length');\n\t\t}\n\n\t\t// Set accepted characters\n\t\t$validChars = self::getBase32LookupTable();\n\n\t\t// Generates a strong secret\n\t\t$secret = \\MWCryptRand::generate( $secretLength );\n\t\t$secretEnc = '';\n\t\tfor( $i = 0; $i < strlen($secret); $i++ ) {\n\t\t\t$secretEnc .= $validChars[ord($secret[$i]) & 31];\n\t\t}\n\n\t\treturn $secretEnc;\n\n\t}", "public static function createSecret($secretLength = 16)\n {\n $validChars = self::_getBase32LookupTable();\n $secret = '';\n for ($i = 0; $i < $secretLength; $i++) {\n $secret .= $validChars[array_rand($validChars)];\n }\n return $secret;\n }", "public function createSecret($secretLength = 16)\n {\n $validChars = $this->_getBase32LookupTable();\n unset($validChars[32]);\n\n $secret = '';\n for ($i = 0; $i < $secretLength; $i++) {\n $secret .= $validChars[array_rand($validChars)];\n }\n return $secret;\n }", "public static function generate_secret_key($length = 16) {\n\t\t$b32 \t= \"234567QWERTYUIOPASDFGHJKLZXCVBNM\";\n\t\t$s \t= \"\";\n\n\t\tfor ($i = 0; $i < $length; $i++)\n\t\t\t$s .= $b32[rand(0,31)];\n\n\t\treturn $s;\n\t}", "protected function createSecretKey()\n\t{\n\t\treturn random_string('unique');\n\t}", "public function generateSecretKey($length = 16, $prefix = '')\n {\n return $this->generateBase32RandomKey($length, $prefix);\n }", "function generateFixedSalt16Byte()\r\n{\r\n return \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\r\n}", "public function createSecret(int $secretLength = 16) : string\n {\n $validChars = self::base32LookupTable();\n\n // Valid secret lengths are 80 to 640 bits\n if ($secretLength < 16 || $secretLength > 128) {\n throw new Exception('Bad secret length');\n }\n\n // @codeCoverageIgnoreStart\n $rnd = false;\n if (function_exists('random_bytes')) {\n $rnd = random_bytes($secretLength);\n }\n\n if (!$rnd) {\n throw new Exception('No source of secure random');\n }\n // @codeCoverageIgnoreEnd\n\n $secret = '';\n for ($i = 0; $i < $secretLength; ++$i) {\n $secret .= $validChars[ord($rnd[$i]) & 31];\n }\n\n return $secret;\n }", "public static function createApiKey()\n\t{\n\t\treturn Str::random(32);\n\t}", "function createToken() {\n\treturn bin2hex(openssl_random_pseudo_bytes(32));\n}", "public function generateSecret($prettyPrinting = FALSE) {\n\t\t$key = $this->getBase32Conversor()->randomBase32String(self::KEY_BYTE_LENGTH);\n\t\tif ($prettyPrinting) {\n\t\t\t$key = chunk_split($key, 4, ' ');\n\t\t}\n\t\treturn $key;\n\t}", "function generate_key(): string\n{\n $keyset = \"0123456789ABCDEF\";\n do {\n $key = \"\";\n for ($i = 0; $i < 16; $i++) {\n $key .= substr($keyset, rand(0, strlen($keyset)-1), 1);\n }\n } while (substr($key, 0, 1) == \"0\");\n return $key;\n}", "public static function generateKey(){\n $key = '';\n // [0-9a-z]\n for ($i=0;$i<32;$i++){\n $key .= chr(rand(48, 90));\n }\n self::$_key = $key;\n }", "public static function randombytes_random16()\n {\n return '';\n }", "public function createSecret($secretLength = 16)\n {\n $validChars = $this->_getBase32LookupTable();\n\n // Valid secret lengths are 80 to 640 bits\n if ($secretLength < 16 || $secretLength > 128) {\n throw new Exception('Bad secret length');\n }\n $secret = '';\n $rnd = false;\n if (function_exists('random_bytes')) {\n $rnd = random_bytes($secretLength);\n } elseif (function_exists('mcrypt_create_iv')) {\n $rnd = mcrypt_create_iv($secretLength, MCRYPT_DEV_URANDOM);\n } elseif (function_exists('openssl_random_pseudo_bytes')) {\n $rnd = openssl_random_pseudo_bytes($secretLength, $cryptoStrong);\n if (!$cryptoStrong) {\n $rnd = false;\n }\n }\n if ($rnd !== false) {\n for ($i = 0; $i < $secretLength; ++$i) {\n $secret .= $validChars[ord($rnd[$i]) & 31];\n }\n } else {\n throw new Exception('No source of secure random');\n }\n\n return $secret;\n }", "function generateFixedSalt32Byte()\r\n{\r\n return \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\r\n}", "public static function createKey() {\r\n $MIN = 100000;\r\n $MAX = 922337203685477580;\r\n return mt_rand($MIN,$MAX);\r\n }", "private function genRandomKey()\n {\n return strtoupper(str_random(32));\n }", "private function generateAPIKey() {\n $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n $length = 32;\n\n $new_api_key = '';\n $max = mb_strlen($keyspace, '8bit') - 1;\n for ($i = 0; $i < $length; ++$i) {\n $new_api_key .= $keyspace[random_int(0, $max)];\n }\n\n return $new_api_key;\n }", "private function generateRandomKey()\n {\n return substr(base_convert(sha1(uniqid(mt_rand(), true)), 16, 36), 0, 8);\n }", "public function generateEncryptionSecret(): string\n {\n try {\n return sodium_bin2hex(sodium_crypto_secretbox_keygen());\n } catch (SodiumException $e) {\n throw new RuntimeException('Could not generate encryption key', 0, $e);\n }\n }", "public function newSecret(): string\n {\n $secret = str_random(32);\n $this->secret = $secret;\n $this->save();\n\n return $secret;\n }", "function mysql_aes_key($key)\n{\n $bytes = 16;\n $newKey = \\str_repeat(\\chr(0), $bytes);\n $length = \\strlen($key);\n\n for ($i = 0; $i < $length; $i++) {\n $index = $i % $bytes;\n $newKey[$index] = $newKey[$index] ^ $key[$i];\n }\n\n return $newKey;\n}", "public function generateToken()\n {\n $token = openssl_random_pseudo_bytes(16);\n \n $token = bin2hex($token);\n \n return $token;\n }", "abstract protected function generateKey();", "private static function _base32_encode($secret, $padding = true)\n {\n if (empty($secret)) return '';\n\n $base32chars = self::_get_base32_lookup_table();\n\n $secret = str_split($secret);\n $bin_str = \"\";\n for ($i = 0; $i < count($secret); $i++) \n {\n $bin_str .= str_pad(base_convert(ord($secret[$i]), 10, 2), 8, '0', STR_PAD_LEFT);\n }\n $five_bit_bin_arr = str_split($bin_str, 5);\n $base32 = \"\";\n $i = 0;\n while ($i < count($five_bit_bin_arr)) \n {\n $base32 .= $base32chars[base_convert(str_pad($five_bit_bin_arr[$i], 5, '0'), 2, 10)];\n $i++;\n }\n if ($padding && ($x = strlen($bin_str) % 40) != 0) \n {\n if ($x == 8) $base32 .= str_repeat($base32chars[32], 6);\n elseif ($x == 16) $base32 .= str_repeat($base32chars[32], 4);\n elseif ($x == 24) $base32 .= str_repeat($base32chars[32], 3);\n elseif ($x == 32) $base32 .= $base32chars[32];\n }\n return $base32;\n }", "protected function getRandomKey()\n {\n return Str::random(32);\n }", "public function generateAuthKey()\n {\n // default length=32\n $this->auth_key = Yii::$app->security->generateRandomString();\n }" ]
[ "0.7042178", "0.69217473", "0.6914015", "0.69081116", "0.6839549", "0.67635924", "0.6713405", "0.66964394", "0.662873", "0.6366154", "0.6325132", "0.6315783", "0.6314056", "0.63033956", "0.626251", "0.6223508", "0.62070405", "0.6206676", "0.61957306", "0.6176235", "0.61426216", "0.6140766", "0.61182374", "0.61048776", "0.61047566", "0.60956407", "0.6078489", "0.6067226", "0.6005766", "0.60030115" ]
0.71212524
0
Decodes a base32 (without padding) string.
protected static function base32Decode(string $base32) : string { $buffer = ''; // Map each character to a group of 5 bits and pass to the buffer foreach (str_split($base32) as $char) { $buffer .= sprintf('%05b', strpos(self::CHARSET, $char)); } $string = ''; // Split the buffer into bytes, convert them to ASCII and add to the string foreach (str_split($buffer, 8) as $byte) { $string .= chr(bindec(str_pad($byte, 8, '0', STR_PAD_RIGHT))); } return $string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function base32_decode($b32) {\n\n\t\t$b32 \t= strtoupper($b32);\n\n\t\tif (!preg_match('/^[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]+$/', $b32, $match))\n\t\t\tthrow new Exception('Invalid characters in the base32 string.');\n\n\t\t$l \t= strlen($b32);\n\t\t$n\t= 0;\n\t\t$j\t= 0;\n\t\t$binary = \"\";\n\n\t\tfor ($i = 0; $i < $l; $i++) {\n\n\t\t\t$n = $n << 5; \t\t\t\t// Move buffer left by 5 to make room\n\t\t\t$n = $n + self::$lut[$b32[$i]]; \t// Add value into buffer\n\t\t\t$j = $j + 5;\t\t\t\t// Keep track of number of bits in buffer\n\n\t\t\tif ($j >= 8) {\n\t\t\t\t$j = $j - 8;\n\t\t\t\t$binary .= chr(($n & (0xFF << $j)) >> $j);\n\t\t\t}\n\t\t}\n\n\t\treturn $binary;\n\t}", "public function decode($value) {\n if (strlen($value) === 0) return '';\n if (preg_match('/[^' . preg_quote($this->dictionary) . ']/', $value) !== 0)\n throw new TwoFactorAuthenticationException('Invalid Base32 String');\n $bufferString = '';\n foreach (str_split($value) as $character) {\n if ($character !== '=')\n $bufferString .= str_pad(decbin($this->lookup[$character]), 5, 0, STR_PAD_LEFT);\n }\n $bufferLength = strlen($bufferString);\n $bufferBlocks = trim(chunk_split(substr($bufferString, 0, $bufferLength - ($bufferLength % 8)), 8, ' '));\n\n $outputString = '';\n foreach (explode(' ', $bufferBlocks) as $block)\n $outputString .= chr(bindec(str_pad($block, 8, 0, STR_PAD_RIGHT)));\n return $outputString;\n }", "private static function base32Decode(string $secret) : string\n {\n if (empty($secret)) {\n return '';\n }\n\n $base32chars = self::base32LookupTable();\n $base32charsFlipped = array_flip($base32chars);\n\n $paddingCharCount = substr_count($secret, $base32chars[32]);\n $allowedValues = [6, 4, 3, 1, 0];\n if (!in_array($paddingCharCount, $allowedValues)) {\n return '';\n }\n\n for ($i = 0; $i < 4; $i++){\n if ($paddingCharCount == $allowedValues[$i] &&\n substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) {\n return '';\n }\n }\n\n $secret = str_replace('=','', $secret);\n $secret = str_split($secret);\n $binaryString = \"\";\n for ($i = 0; $i < count($secret); $i = $i+8) {\n if (!in_array($secret[$i], $base32chars)) {\n return '';\n }\n\n $x = \"\";\n for ($j = 0; $j < 8; $j++) {\n $secretChar = $secret[$i + $j] ?? 0;\n $base = $base32charsFlipped[$secretChar] ?? 0;\n $x .= str_pad(base_convert($base, 10, 2), 5, '0', STR_PAD_LEFT);\n }\n $eightBits = str_split($x, 8);\n for ($z = 0; $z < count($eightBits); $z++) {\n $binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y : \"\";\n }\n }\n\n return $binaryString;\n }", "protected function _base32Decode($secret)\n {\n if (empty($secret)) {\n return '';\n }\n\n $base32chars = $this->_getBase32LookupTable();\n $base32charsFlipped = array_flip($base32chars);\n\n $paddingCharCount = substr_count($secret, $base32chars[32]);\n $allowedValues = array(6, 4, 3, 1, 0);\n if (!in_array($paddingCharCount, $allowedValues)) {\n return false;\n }\n for ($i = 0; $i < 4; $i++) {\n if ($paddingCharCount == $allowedValues[$i] &&\n substr($secret, -$allowedValues[$i]) != str_repeat($base32chars[32], $allowedValues[$i])) {\n return false;\n }\n }\n $secret = str_replace('=', '', $secret);\n $secret = str_split($secret);\n $binaryString = '';\n for ($i = 0, $iMax = count($secret); $i < $iMax; $i += 8) {\n $x = '';\n if (!in_array($secret[$i], $base32chars)) {\n return false;\n }\n for ($j = 0; $j < 8; $j++) {\n $x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);\n }\n $eightBits = str_split($x, 8);\n foreach ($eightBits as $zValue) {\n $binaryString .= (($y = chr(base_convert($zValue, 2, 10))) || ord($y) == 48) ? $y : '';\n }\n }\n return $binaryString;\n }", "protected function _base32Decode($secret)\n {\n if (empty($secret)) {\n return '';\n }\n\n $base32chars = $this->_getBase32LookupTable();\n $base32charsFlipped = array_flip($base32chars);\n\n $paddingCharCount = substr_count($secret, $base32chars[32]);\n $allowedValues = array(6, 4, 3, 1, 0);\n if (!in_array($paddingCharCount, $allowedValues)) {\n return false;\n }\n for ($i = 0; $i < 4; ++$i) {\n if (\n $paddingCharCount == $allowedValues[$i] &&\n substr($secret, - ($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])\n ) {\n return false;\n }\n }\n $secret = str_replace('=', '', $secret);\n $secret = str_split($secret);\n $binaryString = '';\n for ($i = 0; $i < count($secret); $i = $i + 8) {\n $x = '';\n if (!in_array($secret[$i], $base32chars)) {\n return false;\n }\n for ($j = 0; $j < 8; ++$j) {\n $x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);\n }\n $eightBits = str_split($x, 8);\n for ($z = 0; $z < count($eightBits); ++$z) {\n $binaryString .= (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';\n }\n }\n\n return $binaryString;\n }", "private static function base32Decode($secret)\n\t{\n\t\tif (empty($secret)) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$base32chars = self::getBase32LookupTable();\n\t\t$base32charsFlipped = array_flip($base32chars);\n\n\t\t$paddingCharCount = substr_count($secret, $base32chars[32]);\n\t\t$allowedValues = array(6, 4, 3, 1, 0);\n\t\tif (!in_array($paddingCharCount, $allowedValues)) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ($i = 0; $i < 4; ++$i) {\n\t\t\tif ($paddingCharCount == $allowedValues[$i] &&\n\t\t\t\tsubstr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$secret = str_replace('=', '', $secret);\n\t\t$secret = str_split($secret);\n\t\t$binaryString = '';\n\t\tfor ($i = 0; $i < count($secret); $i = $i + 8) {\n\t\t\t$x = '';\n\t\t\tif (!in_array($secret[$i], $base32chars)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor ($j = 0; $j < 8; ++$j) {\n\t\t\t\t$x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);\n\t\t\t}\n\t\t\t$eightBits = str_split($x, 8);\n\t\t\tfor ($z = 0; $z < count($eightBits); ++$z) {\n\t\t\t\t$binaryString .= (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';\n\t\t\t}\n\t\t}\n\n\t\treturn $binaryString;\n\t}", "private static function _base32_decode($secret)\n {\n if (empty($secret)) return '';\n\n $base32chars = self::_get_base32_lookup_table();\n $base32chars_flipped = array_flip($base32chars);\n\n $padding_char_count = substr_count($secret, $base32chars[32]);\n $allowed_values = array(6, 4, 3, 1, 0);\n if (!in_array($padding_char_count, $allowed_values)) return false;\n for ($i = 0; $i < 4; $i++)\n {\n if ($padding_char_count == $allowed_values[$i] &&\n substr($secret, -($allowed_values[$i])) != str_repeat($base32chars[32], $allowed_values[$i])) return false;\n }\n $secret = str_replace('=','', $secret);\n $secret = str_split($secret);\n $bin_str = \"\";\n for ($i = 0; $i < count($secret); $i = $i+8) \n {\n $x = \"\";\n if (!in_array($secret[$i], $base32chars)) return false;\n for ($j = 0; $j < 8; $j++) \n {\n $x .= str_pad(base_convert(@$base32chars_flipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);\n }\n $eight_bits = str_split($x, 8);\n for ($z = 0; $z < count($eight_bits); $z++) \n {\n $bin_str .= ( ($y = chr(base_convert($eight_bits[$z], 2, 10))) || ord($y) == 48 ) ? $y:\"\";\n }\n }\n return $bin_str;\n }", "function decode($string);", "public static function decode($string);", "function decodeString($string);", "public function DecodeString(string $str){\n $byte_arr = unpack('C*', $str);\n return $this->Decode($byte_arr);\n }", "protected final function _decodeSynchsafe32($val)\n {\n return ($val & 0x7f) | ($val & 0x7f00) >> 1 |\n ($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;\n }", "public function decode( string $value ): string;", "function decode($string, $key = '')\n {\n $key = $this->getKey($key);\n\n if (preg_match('/[^a-zA-Z0-9\\/\\+=]/', $string)) {\n return false;\n }\n\n $dec = base64_decode($string);\n\n if (($dec = $this->mcryptDecode($dec, $key)) === false) {\n return false;\n }\n\n return $dec;\n }", "public static function dec($str)\n {\n\n return unserialize(base64_decode($str));\n\n }", "public function decode(string $data): string\n {\n if (empty($data)) {\n return \"\";\n }\n\n if ($this->isCrockford()) {\n $data = strtoupper($data);\n $data = str_replace([\"O\", \"L\", \"I\", \"-\"], [\"0\", \"1\", \"1\", \"\"], $data);\n }\n\n $this->validateInput($data);\n\n $data = str_split($data);\n $data = array_map(function ($character) {\n if ($character !== $this->padding()) {\n $index = strpos($this->characters(), $character);\n return sprintf(\"%05b\", $index);\n }\n }, $data);\n $binary = implode(\"\", $data);\n\n /* Split to eight bit chunks. */\n $data = str_split($binary, 8);\n\n /* Make sure binary is divisible by eight by ignoring the incomplete byte. */\n $last = array_pop($data);\n if ((null !== $last) && (8 === strlen($last))) {\n $data[] = $last;\n }\n\n return implode(\"\", array_map(function ($byte) {\n //return pack(\"C\", bindec($byte));\n return chr((int)bindec($byte));\n }, $data));\n }", "function hashDecode($data)\n {\n return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));\n }", "function DecodeVal($val) {\n return substr(substr(base64_decode($val), 0, -1), 1);\n }", "function crockford_decode($number, $base, bool $checksum = false): string\n{\n return Crockford::decode($number, $base, $checksum);\n}", "function decode($s) {\n if ($this->kod == 1) {\n $s = $this->win_utf8($s);\n }\n return $s;\n }", "public static function decodeValue($value)\n {\n return base64_decode($value);\n }", "function decode($input) {\n return base64_decode($input);\n }", "public function testDecodeWithTrailingBits(): void\n {\n // Matches the behavior of Google Authenticator, drops extra 2 empty bits\n $this->assertEquals(\n 'c567eceae5e0609685931fd9e8060223',\n unpack(\"H*\", RSCT_OTP\\Base32::decode('YVT6Z2XF4BQJNBMTD7M6QBQCEM'))[1]\n );\n // For completeness, test all the possibilities allowed by Google Authenticator\n // Drop the incomplete empty extra 4 bits (28*5==140bits or 17.5 bytes, chopped to 136 bits)\n $this->assertEquals(\n 'e98d9807766f963fd76be9de3c4e140349',\n unpack(\"H*\", RSCT_OTP\\Base32::decode('5GGZQB3WN6LD7V3L5HPDYTQUANEQ'))[1]\n );\n }", "function decodeInteger($integer);", "public function decode($link)\n {\n $id = $this->alphaToNum($link, $this->CHARSET);\n return (!empty($this->SALT)) ? substr($id, $this->PADDING) : $id;\n }", "protected function base16Decode($strValue) {\r\n \t$strReturn = '';\r\n \tfor($a=0; $a<strlen($strValue); $a+=2){\r\n \t\t$strTmp = substr($strValue,$a,2);\r\n \t\t$int = hexdec($strTmp);\r\n \t\t$strReturn.= chr($int);\r\n \t}\r\n \treturn $strReturn;\r\n }", "function DecodeBase64( $string )\n\t{\n\t\treturn base64_decode( $string );\n\t}", "abstract function decode($bytes);", "function base64Decode($scrambled) {\n // Initialise output variable\n $output = \"\";\n \n // Fix plus to space conversion issue\n $scrambled = str_replace(\" \",\"+\",$scrambled);\n \n // Do encoding\n $output = base64_decode($scrambled);\n \n // Return the result\n return $output;\n}", "public function base58_decode($base58) { \n\n\t// Initialize\n\t$origbase58 = $base58;\n\t$return = \"0\";\n\n\t// Go through string\n\tfor($i = 0; $i < strlen($base58); $i++) {\n\t\t$return = gmp_add(gmp_mul($return, 58), strpos('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz', $base58[$i]));\n\t}\n\t$return = gmp_strval($return, 16);\n\t\t\n\tfor($i = 0; $i < strlen($origbase58) && $origbase58[$i] == \"1\"; $i++) {\n\t\t$return = \"00\" . $return;\n\t}\n\tif(strlen($return) %2 != 0) { $return = \"0\" . $return; }\n\t\n\t// Return\n\treturn $return;\n\n}" ]
[ "0.7243656", "0.7161796", "0.6729308", "0.64577985", "0.64366245", "0.64254874", "0.636153", "0.6198241", "0.60867786", "0.6041026", "0.59015214", "0.5849243", "0.5808985", "0.5790852", "0.5704809", "0.56872135", "0.5678966", "0.56746227", "0.5662673", "0.5658981", "0.5657274", "0.5653711", "0.56391364", "0.5603994", "0.5587955", "0.5523583", "0.550272", "0.5486641", "0.54797846", "0.5469625" ]
0.7620079
0
In this action the page definitition with the given id is loaded, its members set to new values from posted data and saved. Then the PageDefinititionHints list is updated with new values from posted data.
function doAction() { try { // Load the page definitition ... $pageDefinition = PageDefinition::fetch($this->context, Request::post("page_definition_id", Request::TYPE_INTEGER)); // ... set the members ... $pageDefinition->title = Request::post( "label", Request::TYPE_STRING, new Str("")); $pageDefinition->description = Request::post( "description", Request::TYPE_STRING, new Str("")); $pageDefinition->action = Request::post( "action", Request::TYPE_STRING, new Str("")); $pageDefinition->configOnly = Request::post( "admin_only", Request::TYPE_BOOLEAN); $pageDefinition->typeSet = Request::post( "type_set", Request::TYPE_INTEGER); $pageDefinition->defaultTabId = Request::post( "default_tab_id", Request::TYPE_INTEGER, -1); // ... and update the page definitition. $res = $pageDefinition->update(); // Load the PageDefinititionHints::PARENT_PAGE_DEFINITION_COUNT // list ... $hnts = new PageDefinitionHints($this->context, $pageDefinition->id, PageDefinitionHints::PARENT_PAGE_DEFINITION_COUNT); // ... get the new values ... foreach ($hnts as $k=>$v) { $dat = $_POST["hint{$k}"]; $hnts[$k]->maxNoOfChildren = is_numeric($dat) ? intval($dat) : NULL; } // ... and update the list. $hnts->update(); // Set action result. $this->setResult(self::SUCCESS); } catch(ApplicationException $e) { $this->setResult(self::FAIL, $e, $pageDefinition); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_edited_page_to_xml($piecemakerId, $pageId){\n\t\t global $wpdb;\n\n\t\t\t$tempPages = $this->xml_to_table($piecemakerId);\n\t\t\t\n\t\t\t$tempPages['allPages']['type'][$pageId] = $_POST['typeOur'];\n\t\t\t\n\t\t\t\n\n\t\t\tif($tempPages['allPages']['type'][$pageId] == \"image\") {\n\t\t\t\t$tempPages['allPages']['slideTitle'][$pageId] = trim($_POST['imageTitle']);\n\t\t\t\t$tempPages['allPages']['slideText'][$pageId] = trim($_POST['slideText']);\n\t\t\t\t$tempPages['allPages']['hyperlinkURL'][$pageId] = $_POST['hyperlinkURL'];\n\t\t\t\t$tempPages['allPages']['hyperlinkTarget'][$pageId] = $_POST['hyperlinkTarget'];\n\t\t\t\t$tempPages['allPages']['videoWidth'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['videoHeight'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['autoplay'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['large'][$pageId] = \"\";\n\t\t\t} elseif($tempPages['allPages']['type'][$pageId] == \"video\") {\n\t\t\t\t$tempPages['allPages']['slideTitle'][$pageId] = trim($_POST['videoTitle']);\n\t\t\t\t$tempPages['allPages']['videoWidth'][$pageId] = $_POST['videoWidth'];\n\t\t\t\t$tempPages['allPages']['videoHeight'][$pageId] = $_POST['videoHeight'];\n\t\t\t\t$tempPages['allPages']['autoplay'][$pageId] = $_POST['autoplay'];\n\t\t\t\t$tempPages['allPages']['large'][$pageId] = $_POST['large'];\n\t\t\t\t$tempPages['allPages']['slideText'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['hyperlinkURL'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['hyperlinkTarget'][$pageId] = \"\";\n\t\t\t} elseif($tempPages['allPages']['type'][$pageId] == \"flash\") {\n\t\t\t\t$tempPages['allPages']['slideTitle'][$pageId] = trim($_POST['flashTitle']);\n\t\t\t\t$tempPages['allPages']['large'][$pageId] = $_POST['large'];\n\t\t\t\t$tempPages['allPages']['slideText'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['hyperlinkURL'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['hyperlinkTarget'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['videoWidth'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['videoHeight'][$pageId] = \"\";\n\t\t\t\t$tempPages['allPages']['autoplay'][$pageId] = \"\";\n\t\t\t}\n\n\t\t\t$this->modify_xml($tempPages, $piecemakerId );\n\t}", "function setAsStartPageObject()\n\t{\n\t\tglobal $ilCtrl, $lng;\n\n\t\t$this->checkPermission(\"write\");\n\n\t\tif (!is_array($_POST[\"imp_page_id\"]) || count($_POST[\"imp_page_id\"]) != 1)\n\t\t{\n\t\t\tilUtil::sendInfo($lng->txt(\"wiki_select_one_item\"), true);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->object->removeImportantPage((int) $_POST[\"imp_page_id\"][0]);\n\t\t\t$this->object->setStartPage(ilWikiPage::lookupTitle((int) $_POST[\"imp_page_id\"][0]));\n\t\t\t$this->object->update();\n\t\t\tilUtil::sendSuccess($this->lng->txt(\"msg_obj_modified\"),true);\n\t\t}\n\t\t$ilCtrl->redirect($this, \"editImportantPages\");\n\t}", "public function setPageID(){/*ACTUALLY NOT DEFINED*/}", "function editImportantPagesObject()\n\t{\n\t\tglobal $tpl, $ilToolbar, $ilTabs, $lng, $ilCtrl;\n\n\t\t$this->checkPermission(\"write\");\n\n\t\tilUtil::sendInfo($lng->txt(\"wiki_navigation_info\"));\n\t\t\n\t\t$ipages = ilObjWiki::_lookupImportantPagesList($this->object->getId());\n\t\t$ipages_ids = array();\n\t\tforeach ($ipages as $i)\n\t\t{\n\t\t\t$ipages_ids[] = $i[\"page_id\"];\n\t\t}\n\n\t\t// list pages\n\t\tinclude_once(\"./Modules/Wiki/classes/class.ilWikiPage.php\");\n\t\t$pages = ilWikiPage::getAllPages($this->object->getId());\n\t\t$options = array(\"\" => $lng->txt(\"please_select\"));\n\t\tforeach ($pages as $p)\n\t\t{\n\t\t\tif (!in_array($p[\"id\"], $ipages_ids))\n\t\t\t{\n\t\t\t\t$options[$p[\"id\"]] = ilUtil::shortenText($p[\"title\"], 60, true);\n\t\t\t}\n\t\t}\n\t\tif (count($options) > 0)\n\t\t{\n\t\t\tinclude_once(\"./Services/Form/classes/class.ilSelectInputGUI.php\");\n\t\t\t$si = new ilSelectInputGUI($lng->txt(\"wiki_pages\"), \"imp_page_id\");\n\t\t\t$si->setOptions($options);\n\t\t\t$si->setInfo($lng->txt(\"\"));\n\t\t\t$ilToolbar->addInputItem($si);\n\t\t\t$ilToolbar->setFormAction($ilCtrl->getFormAction($this));\n\t\t\t$ilToolbar->addFormButton($lng->txt(\"add\"), \"addImportantPage\");\n\t\t}\n\n\n\t\t$ilTabs->activateTab(\"settings\");\n\t\t$this->setSettingsSubTabs(\"imp_pages\");\n\n\t\tinclude_once(\"./Modules/Wiki/classes/class.ilImportantPagesTableGUI.php\");\n\t\t$imp_table = new ilImportantPagesTableGUI($this, \"editImportantPages\");\n\n\t\t$tpl->setContent($imp_table->getHTML());\n\t}", "function save_postdata( $post_id ) {\n\tglobal $post, $new_meta_boxes;\n\n\tif(isset($post) && $post->post_type=='page'){\n\t\t$new_meta_boxes=$GLOBALS['new_meta_boxes'];\n\t\tpexeto_save_meta_data($new_meta_boxes, $post_id);\n\t}\n}", "function edit_page($piecemakerId, $pageId) {\n\t\t$this->add_page_form($piecemakerId, $pageId, \"true\");\n\t}", "public function actionUpdate($id) {\n $data = array();\n $Pagemodel = $this->findModel($id);\n $updatePage = new UpdatePage();\n $model = $updatePage->findIdentity($id);\n \n ######################FILEUPLOAD MODEL############################\n if (strtolower($model->slug) == 'tips' ) {\n $modelImageUpload = new ImageUpload();\n $modelImageUpload->scenario = 'update-profile';\n }\n else\n {\n $modelImageUpload = '';\n }\n \n $userpost = Yii::$app->request->post('UpdatePage');\n if (isset($userpost) && !empty($userpost)) {\n if (Yii::$app->request->isAjax) {\n $Pagemodel->status = $userpost['status'];\n if ($Pagemodel->save()) {\n Yii::$app->session->setFlash('item', $Pagemodel->status . ' status set for selected page successfully.');\n } else {\n Yii::$app->session->setFlash('item', 'No status is set for selected page, please try again.');\n }\n die();\n }\n \n ###########################FILE UPLOAD ONLY FOR TIPS PAGE#################################################################################\n if (Yii::$app->request->isPost && strtolower($model->slug) == 'tips' ) {\n \n $modelImageUpload->imageUpload = UploadedFile::getInstance($modelImageUpload, 'imageUpload'); \n \n if ($modelImageUpload->imageUpload && $uploadedFileNameVal = $modelImageUpload->uploadfile()) {\n $model->image = $uploadedFileNameVal;\n }\n }\n #####################################################################################################################\n \n if ($model->load(Yii::$app->request->post()) && $model->updatePage($id)) {\n //return $this->redirect(['view', 'id' => $id]);\n Yii::$app->session->setFlash('item', 'Page has been updated successfully!');\n return $this->redirect(['index']);\n } else {\n $data['respmesg'] = \"Please enter valid values for all the fields.\";\n $data['class'] = \"alert-danger\";\n }\n } else {\n $model->setAttributes($Pagemodel->getAttributes());\n }\n return $this->render('update', [\n 'data' => $data,\n 'model' => $model,\n 'modelImageUpload' => $modelImageUpload\n ]);\n }", "public function update(Requests\\PageRequest $request, $id)\n {\n if (! $page = Page::find($id)) {\n return redirect()\n ->route('admin.pages.index')\n ->with('error', 'Could not find that page.');\n }\n\n $home_content = array();\n// $home_content['home_content'] = $request->extra_content;\n $request->merge(['extra_content' => \\GuzzleHttp\\json_encode($request->extra_content)]);\n// dd($request->extra_content);\n// dd($request);\n\n\n // Set checkboxes that aren't checked (default value), if it's not set in the form.\n if (! $request->active) {\n $request->merge(['active' => 0]);\n }\n if (! $request->on_main_nav) {\n $request->merge(['on_main_nav' => 0]);\n }\n if (! $request->protected) {\n $request->merge(['protected' => 0]);\n }\n\n $meta = $page->meta ?: $page->meta()->getRelated();\n $meta->page()->associate($page);\n $meta->fill($request->all())->save();\n\n $extra = ($page->extra) ?: $page->extra()->getRelated();\n $extra->page()->associate($page);\n $extra->fill($request->all())->save();\n\n // Get the banners and sync with order\n if (! $request->banner_order) {\n $bannersPivotData = [];\n } else {\n $order = explode(',', $request->banner_order);\n $bannersPivotData = [];\n foreach ($order as $key => $ordering) {\n if (Banner::find($ordering)) {\n $bannersPivotData[$ordering]['order'] = $key + 1;\n }\n }\n }\n $page->banners()->sync($bannersPivotData);\n\n // Get the documents and sync with order\n if (! $request->document_order) {\n $documentsPivotData = [];\n } else {\n $order = explode(',', $request->document_order);\n $documentsPivotData = [];\n foreach ($order as $key => $ordering) {\n if (Media::documents()->find($ordering)) {\n $documentsPivotData[$ordering]['order'] = $key + 1;\n }\n }\n }\n $page->documents()->sync($documentsPivotData);\n\n // Get the images and sync with order\n if (! $request->image_order) {\n $imagesPivotData = [];\n } else {\n $order = explode(',', $request->image_order);\n $imagesPivotData = [];\n foreach ($order as $key => $ordering) {\n if (Media::images()->find($ordering)) {\n $imagesPivotData[$ordering]['order'] = $key + 1;\n }\n }\n }\n $page->images()->sync($imagesPivotData);\n\n // Sort out the fields for certain groups.\n $finalRequest = $this->finalRequestFields($request);\n\n if (! $page->update($finalRequest)) {\n return back()\n ->withInput()\n ->with('error', 'Failed to edited that page.');\n }\n\n if ($page->parent_id == 1) {\n return redirect()\n ->route('admin.pages.edit', $page->id)\n ->with('success', 'Edited that page.');\n }\n\n return redirect()\n ->route('admin.pages.edit', $page->id)\n ->with('success', 'Edited that page.');\n }", "public function definition_after_data() {\n global $DB;\n\n $mform = $this->_form;\n\n // Check that we are updating a current customcert.\n if ($this->id) {\n // Get the pages for this customcert.\n if ($pages = $DB->get_records('customcert_pages', array('customcertid' => $this->id))) {\n // Loop through the pages.\n foreach ($pages as $p) {\n // Set the width.\n $element = $mform->getElement('pagewidth_' . $p->id);\n $element->setValue($p->width);\n // Set the height.\n $element = $mform->getElement('pageheight_' . $p->id);\n $element->setValue($p->height);\n // Set the margin.\n $element = $mform->getElement('pagemargin_' . $p->id);\n $element->setValue($p->margin);\n }\n }\n }\n }", "function set_id( $id ){\n\t\t$this->id = $id;\n\t\t// this is add request. so number is 0\n\t\tif( $this->id == $this->id_base ){\n\t\t\t$this->number = 0;\n\t\t\t$this->is_new = true;\n\t\t}\n\t\t// parse number\n\t\telse{\n\t\t\t$this->number = str_replace($this->id_base.'-', '', $this->id);\n\n\t\t\t// load instance data\n\t\t\t$this->instance = jcf_field_settings_get( $this->id );\n\t\t\tif( !empty($this->instance) ){\n\t\t\t\t$this->slug = $this->instance['slug'];\n\t\t\t}\n\t\t}\n\t}", "public static function on_definition_manager() {\n\t\t\n\t\t// Check Admin\n\t\tself::_check_admin();\n\t\t\n\t\t// Get Data\n\t\t$definition = Request::get(\"definition\");\n\t\t$class = ucfirst($definition).\"_Definition\";\n\t\t$obj = new $class();\n\t\t$id = Request::get(\"id\",\"int\");\n\t\t$entry = ORM::for_table($definition);\n\t\t\n\t\t// Load Entry if isnt is a update or create\n\t\t$entry = ($id>0)?$entry->find_one($id):$obj->create($entry->create(),Request::get(\"argument\",\"string\"));\n\t\t\n\t\t// Manager\n\t\t$body = HTML::header(1,I18n::_(\"definition.\".$definition.\".edit_entry\"));\n\t\t$body .= Helper::print_errors();\n\t\t\n\t\t// Open Body\n\t\t$body .= HTML::div_open(null,\"content\");\n\t\t$body .= HTML::form_open(Registry::get(\"request.referer\").\"?command=definition_update\",\"post\",array(\"enctype\"=>\"multipart/form-data\"));\n\t\t$body .= HTML::hidden(\"definition\",$definition);\n\t\t$body .= HTML::hidden(\"id\",$id);\n\t\t\n\t\t// Print Form Elements\n\t\tforeach($obj->blueprint as $field => $config) {\n\t\t\t\n\t\t\t// Merge Config with defaults\n\t\t\t$config = array_merge($obj->default_config,$config);\n\t\t\t\n\t\t\t// Get Field Name\n\t\t\t$name = $definition.\"[\".$field.\"]\";\n\t\t\t\n\t\t\t// Check for Visibility\n\t\t\tif(!$config[\"hidden\"]) {\n\t\t\t\t\n\t\t\t\t// Open Row\n\t\t\t\t$body .= HTML::div_open(null,\"row\");\n\t\t\t\t\n\t\t\t\t// Get Label and Name\n\t\t\t\t$label = ($config[\"label\"])?I18n::_(\"definition.\".$definition.\".field_\".$field):null;\n\t\t\t\t\n\t\t\t\t// Switch Field Type\n\t\t\t\tswitch($config[\"as\"]) {\n\t\t\t\t\t\n\t\t\t\t\t// Boolean\n\t\t\t\t\tcase \"boolean\" : {\n\t\t\t\t\t\t$body .= HTML::label($name,$label);\n\t\t\t\t\t\t$body .= HTML::div_open(null,\"radiogroup\");\n\t\t\t\t\t\t$body .= HTML::radio($name,1,I18n::_(\"definition.\".$definition.\".field_\".$field.\"_true\"),($entry->$field==1)?array(\"checked\"=>\"checked\"):array());\n\t\t\t\t\t\t$body .= HTML::radio($name,0,I18n::_(\"definition.\".$definition.\".field_\".$field.\"_false\"),($entry->$field==0)?array(\"checked\"=>\"checked\"):array());\n\t\t\t\t\t\t$body .= HTML::div_close();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Text Inputs\n\t\t\t\t\tcase \"number\":\n\t\t\t\t\tcase \"string\": $body .= HTML::text($name,$label,$entry->$field).HTML::br(); break;\n\t\t\t\t\t\n\t\t\t\t\t// Textareas\n\t\t\t\t\tcase \"html\": $body .= HTML::textarea($name,$label,$entry->$field,array(\"class\"=>\"hanya-editor-html\")); break;\n\t\t\t\t\tcase \"textile\": $body .= HTML::textarea($name,$label,$entry->$field,array(\"class\"=>\"hanya-editor-textile\")); break;\n\t\t\t\t\tcase \"markdown\": $body .= HTML::textarea($name,$label,$entry->$field,array(\"class\"=>\"hanya-editor-markdown\")); break;\n\t\t\t\t\tcase \"text\": $body .= HTML::textarea($name,$label,$entry->$field).HTML::br(); break;\n\t\t\t\t\t\n\t\t\t\t\t// Special\n\t\t\t\t\tcase \"time\": $body .= HTML::text($name,$label,$entry->$field,array(\"class\"=>\"hanya-timepicker\")).HTML::br(); break;\n\t\t\t\t\tcase \"date\": $body .= HTML::text($name,$label,$entry->$field,array(\"class\"=>\"hanya-datepicker\")).HTML::br(); break;\n\t\t\t\t\tcase \"selection\": $body .= HTML::select($name,$label,HTML::options($config[\"options\"],$entry->$field)).HTML::br(); break;\n\t\t\t\t\t\n\t\t\t\t\t// Reference Select\n\t\t\t\t\tcase \"reference\": {\n\t\t\t\t\t\t$data = array();\n\t\t\t\t\t\tforeach(ORM::for_table($config[\"definition\"])->find_many() as $item) {\n\t\t\t\t\t\t\t$data[$item->id] = $item->$config[\"field\"];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$body .= HTML::select($name,$label,HTML::options($data,$entry->$field)).HTML::br();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// File Select\n\t\t\t\t\tcase \"file\": {\n\t\t\t\t\t\t$data = array();\n\t\t\t\t\t\tif($config[\"blank\"]) {\n\t\t\t\t\t\t\t$data = array(\"\"=>\"---\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$content = Disk::read_directory(\"uploads/\".$config[\"folder\"]);\n\t\t\t\t\t\t$files = Disk::get_all_files($content);\n\t\t\t\t\t\t$directories = array(\"/\"=>\"/\");\n\t\t\t\t\t\tforeach(Disk::get_all_directories($content) as $dir) {\n\t\t\t\t\t\t\t$directories[\"/\".$dir] = \"/\".$dir;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforeach($files as $file) {\n\t\t\t\t\t\t\t$data[$file] = $file;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($config[\"upload\"]) {\n\t\t\t\t\t\t\t$upload = HTML::br().I18n::_(\"system.definition.upload_file\").HTML::file($definition.\"[\".$field.\"_upload]\");\n\t\t\t\t\t\t\t$upload .= I18n::_(\"system.definition.upload_file_to\").HTML::select($definition.\"[\".$field.\"_upload_dir]\",null,HTML::options($directories));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$upload = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$body .= HTML::label($name,$label).I18n::_(\"system.definition.select_file\");\n\t\t\t\t\t\t$body .= HTML::select($name,null,HTML::options($data,$entry->$field)).$upload.HTML::br();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\t// Open Row\n\t\t\t\t$body .= HTML::div_open(null,\"hidden-row\");\n\t\t\t\t\n\t\t\t\t// Render Hidden Field\n\t\t\t\t$body .= HTML::hidden($name,$entry->$field);\n\t\t\t}\n\t\t\t\n\t\t\t// Close Row\n\t\t\t$body .= HTML::div_close();\n\t\t}\n\t\t\n\t\t// Close Manager\n\t\t$body .= HTML::submit(I18n::_(\"system.definition.save\"));\n\t\t$body .= HTML::form_close();\n\t\t$body .= HTML::div_close();\n\t\t\n\t\t// End\n\t\techo Render::file(\"system/views/definition/manager.html\",array(\"body\"=>$body)); exit;\n\t}", "function save_metabox_data($post_id){\t\n\t\t\t\n\t\tupdate_post_meta($post_id,'wiki-contributons-status',$_REQUEST['wiki-tabel-shownorhide']);\n\t\t\n\t}", "function set_page_vars($id) {\n global $_PAGE_TITLE, $_IMAGE_URL, $_PAGE_ID;\n\n $json = file_get_contents(\"http://1504.nl/api/?t=page&a=get&i=\" . $id);\n $json = Page_helper::remove_utf8_bom($json);\n $page = json_decode($json);\n // print_r($page);\n\n $_PAGE_ID = $page[0]->id;\n $_PAGE_TITLE = $page[0]->name;\n $_IMAGE_URL = $page[0]->image_url;\n }", "function admin_edit($id=null)\n\t{\n\t $id = base64_decode($id);\n\t $this->set('pagetitle',\"Edit Page\");\t\n\t \n\t $this->Page->id = $id;\n\t if($id)\n\t {\n\t\t$count=$this->Page->find('count',array('conditions' => array('Page.id' => $id))); \n if($count >0)\n\t\t{\n\t\t if(!empty($this->data))\n\t\t {\n\t\t\t$this->data['Page']['name']=$this->Page->field('name');\n\t\t\tif($this->Page->save($this->data))\n\t\t\t{ \t\t\n\t\t\t $this->Session->setFlash('The Page has been saved','message/green');\n\t\t\t $this->redirect(array('action' => 'index'));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t $this->Session->setFlash('The Page could not be saved. Please, try again.','message/yellow');\n\t\t\t}\n\t\t }\n\t\t if(empty($this->data))\n\t\t {\n\t\t\t$this->data = $this->Page->read(null, $id);\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t $this->Session->setFlash('Invalid Page', 'message/yellow');\n\t\t $this->redirect(array('action' => 'index'));\n\t\t}\n\t } \n\t}", "public static function on_definition_update() {\n\t\t\n\t\t// Check Admin\n\t\tself::_check_admin();\n\t\t\n\t\t// Get Data\n\t\t$definition = Request::post(\"definition\");\n\t\t$id = Request::post(\"id\",\"int\");\n\t\t$data = Request::post($definition,\"array\");\n\t\t$class = $class= ucfirst($definition).\"_Definition\";\n\t\t$obj = new $class();\n\t\t$entry = ORM::for_table($definition);\n\t\t\n\t\t// Check for new Entry\n\t\tif($id > 0) {\n\t\t\t$is_new = false;\n\t\t\t$entry = $entry->find_one($id);\n\t\t} else {\n\t\t\t$is_new = true;\n\t\t\t$entry = $entry->create();\n\t\t}\n\t\t\n\t\t// Append Data\n\t\tforeach($data as $field => $value) {\n\t\t\tif(array_key_exists($field,$obj->blueprint)) {\n\t\t\t\t$entry->$field = stripslashes($value);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Check For Special Fields\n\t\tforeach($obj->blueprint as $field => $config) {\n\t\t\tswitch($config[\"as\"]) {\n\t\t\t\tcase \"file\" : {\n\t\t\t\t\t$target_dir = Registry::get(\"system.path\").\"uploads/\".$config[\"folder\"].$data[$field.\"_upload_dir\"];\n\t\t\t\t\tif($config[\"upload\"] && $_FILES[$definition][\"size\"][$field.\"_upload\"] > 0 && Disk::has_directory($target_dir)) {\n\t\t\t\t\t\t$filename = $_FILES[$definition][\"name\"][$field.\"_upload\"];\n\t\t\t\t\t\t$tmpfile = $_FILES[$definition][\"tmp_name\"][$field.\"_upload\"];\n\t\t\t\t\t\t$newfile = $target_dir.\"/\".$filename;\n\t\t\t\t\t\tDisk::copy($tmpfile,$newfile);\n\t\t\t\t\t\t$entry->$field = $filename;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tunset($data[$field.\"_upload\"]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Do Ordering\n\t\tif($obj->orderable && $is_new) {\n\t\t\t$last_entry = ORM::for_table($definition)->select(\"ordering\")->order_by_desc(\"ordering\");\n\t\t\tforeach($obj->groups as $group) {\n\t\t\t\tif($entry->$group) {\n\t\t\t\t\t$last_entry = $last_entry->where($group,$entry->$group);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$last_entry = $last_entry->limit(1)->find_one();\n\t\t\tif($last_entry) {\n\t\t\t\t$entry->ordering = $last_entry->ordering+1;\n\t\t\t} else {\n\t\t\t\t$entry->ordering = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Validate and Save\n\t\tif(self::_validate($entry,$obj->blueprint,$obj->default_config)) {\n\t\t\t$entry->save();\n\t\t} else {\n\t\t\tdie(\"Validation failed\");\n\t\t}\n\t\t\n\t\t// Dispatch before_update Event\n\t\t$entry = $obj->before_update($entry);\n\t\t\n\t\t// Redirect\n\t\techo Render::file(\"system/views/shared/close.html\"); exit;\n\t}", "public function onAfterEdit($module, $page, $id) {\nglobal $_LW;\nif ($page=='events_edit' || $page=='events_sub_edit') { // if loading data for the events editor form\n\tif (!empty($_LW->is_first_load) && !empty($id)) { // if loading the editor for the first time for an existing item\n\t\tif ($fields=$_LW->getCustomFields($module, $id)) { // getCustomFields($module, $id) gets any previously saved custom data for the item of this $module and $id\n\t\t\tforeach($fields as $key=>$val) { // add previously saved data to POST data so it prepopulates in the editor form\n\t\t\t\t$_LW->_POST[$key]=$val;\n\t\t\t};\n\t\t};\n\t};\n};\nif ($page=='profiles_edit' && $_LW->_GET['tid']==1) { // if loading the profiles editor, but only for profile type with ID = 1\n\t// do something for this type only\n};\n}", "function insert_default_prefs($id){\n\t\t\t\tglobal $sql, $aa, $plugintable, $eArrayStorage;\n\t\t\t\t$plugintable\t= \"pcontent\";\n\t\t\t\t$plugindir\t\t= e_PLUGIN.\"content/\";\n\t\t\t\tunset($content_pref, $tmp);\n\t\t\t\t\n\t\t\t\tif(!is_object($aa)){\n\t\t\t\t\trequire_once($plugindir.\"handlers/content_class.php\");\n\t\t\t\t\t$aa = new content;\n\t\t\t\t}\n\n\t\t\t\t$content_pref = $aa -> ContentDefaultPrefs($id);\n\t\t\t\t$tmp = $eArrayStorage->WriteArray($content_pref);\n\n\t\t\t\t$sql -> db_Update($plugintable, \"content_pref='$tmp' WHERE content_id='$id' \");\n\t\t}", "protected function setMemberDefaults(){\n parent::setMemberDefaults();\n if(!$this->id) $this->id = UniqId::get(\"faq-\");\n }", "public function modifiertitre() {\n $idPage = $this->input->post('idPage');\n $titre = ($this->input->post('titre'));\n $this->admin_model->updatePage($titre, $idPage, \"titre\");\n }", "function pre_load_edit_page() {\r\n global $wpi_settings;\r\n\r\n if (!empty($_REQUEST['wpi']) && !empty($_REQUEST['wpi']['existing_invoice'])) {\r\n $id = (int) $_REQUEST['wpi']['existing_invoice']['invoice_id'];\r\n if (!empty($id) && !empty($_REQUEST['action'])) {\r\n self::process_invoice_actions($_REQUEST['action'], $id);\r\n }\r\n }\r\n\r\n /** Screen Options */\r\n if (function_exists('add_screen_option')) {\r\n add_screen_option('layout_columns', array('max' => 2, 'default' => 2));\r\n }\r\n\r\n //** Default Help items */\r\n $contextual_help['Creating New Invoice'][] = '<h3>' . __('Creating New Invoice', WPI) . '</h3>';\r\n $contextual_help['Creating New Invoice'][] = '<p>' . __(\"Begin typing the recipient's email into the input box, or double-click to view list of possible options.\", WPI) . '</p>';\r\n $contextual_help['Creating New Invoice'][] = '<p>' . __(\"For new prospects, type in a new email address.\", WPI) . '</p>';\r\n\r\n //** Hook this action is you want to add info */\r\n $contextual_help = apply_filters('wpi_edit_page_help', $contextual_help);\r\n\r\n do_action('wpi_contextual_help', array('contextual_help' => $contextual_help));\r\n }", "private function set_PageData() {\n\n\t\t\t// We have an existing page\n\t\t\t// should feed a wp_update_post not wp_insert_post\n\t\t\t//\n\t\t\tif ( $this->page_exists() ) {\n\t\t\t\t$this->pageData = array(\n\t\t\t\t\t'ID' => $this->linked_postid,\n\t\t\t\t\t'slp_notes' => 'pre-existing page',\n\t\t\t\t);\n\n\t\t\t\t// No page yet, default please.\n\t\t\t\t//\n\t\t\t} else {\n\t\t\t\t$this->pageData = array(\n\t\t\t\t\t'ID' => '',\n\t\t\t\t\t'post_type' => SLPlus::locationPostType,\n\t\t\t\t\t'post_status' => $this->pageDefaultStatus,\n\t\t\t\t\t'post_title' => ( empty( $this->store ) ? 'SLP Location #' . $this->id : $this->store ),\n\t\t\t\t\t'post_content' => '',\n\t\t\t\t\t'slp_notes' => 'new page',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Apply our location page data filters.\n\t\t\t// This is what allows add-ons to tweak page data.\n\t\t\t//\n\t\t\t// FILTER: slp_location_page_attributes\n\t\t\t//\n\t\t\t$this->pageData = apply_filters( 'slp_location_page_attributes', $this->pageData );\n\n\t\t\treturn $this->pageData;\n\t\t}", "function bfa_ata_save_postdata( $post_id ) {\r\n\r\n /* verify this came from the our screen and with proper authorization,\r\n because save_post can be triggered at other times */\r\n// Before using $_POST['value'] \r\nif (isset($_POST['bfa_ata_noncename'])) \r\n{ \r\n\r\n\tif ( !wp_verify_nonce( $_POST['bfa_ata_noncename'], plugin_basename(__FILE__) )) {\r\n\t\treturn $post_id;\r\n\t}\r\n\r\n\tif ( 'page' == $_POST['post_type'] ) {\r\n\t\tif ( !current_user_can( 'edit_page', $post_id ))\r\n\t\t\treturn $post_id;\r\n\t} else {\r\n\t\tif ( !current_user_can( 'edit_post', $post_id ))\r\n\t\t\treturn $post_id;\r\n\t\t}\r\n\r\n\t// Save the data\r\n\t\r\n\t$new_body_title = $_POST['bfa_ata_body_title'];\r\n\t$new_display_body_title = !isset($_POST[\"bfa_ata_display_body_title\"]) ? NULL : $_POST[\"bfa_ata_display_body_title\"];\r\n\t$new_body_title_multi = $_POST['bfa_ata_body_title_multi'];\r\n\t$new_meta_title = $_POST['bfa_ata_meta_title'];\r\n\t$new_meta_keywords = $_POST['bfa_ata_meta_keywords'];\r\n\t$new_meta_description = $_POST['bfa_ata_meta_description'];\r\n\r\n\tupdate_post_meta($post_id, 'bfa_ata_body_title', $new_body_title);\r\n\tupdate_post_meta($post_id, 'bfa_ata_display_body_title', $new_display_body_title);\r\n\tupdate_post_meta($post_id, 'bfa_ata_body_title_multi', $new_body_title_multi);\r\n\tupdate_post_meta($post_id, 'bfa_ata_meta_title', $new_meta_title);\r\n\tupdate_post_meta($post_id, 'bfa_ata_meta_keywords', $new_meta_keywords);\r\n\tupdate_post_meta($post_id, 'bfa_ata_meta_description', $new_meta_description);\r\n\r\n}}", "public function postProcess()\n {\n $pageId = Tools::getValue('id_page');\n if (Tools::isSubmit('submitEditCustomHTMLPage') || Tools::isSubmit('submitEditCustomHTMLPageAndStay')) {\n if ($pageId == 'new')\n $this->processAdd();\n else\n $this->processUpdate();\n }\n else if (Tools::isSubmit('status'.$this->table)) {\n $this->toggleStatus();\n }\n else if (Tools::isSubmit('delete'.$this->table)) {\n $this->processDelete();\n }\n }", "public function information_update() {\r\n $this->check_permission(16);\r\n $content_data['add'] = $this->check_page_action(16, 'add');\r\n $content_data['product_list'] = $this->get_product_list();\r\n $content_data['shift_list'] = $this->get_shift_list();\r\n $content_data['category_list'] = $this->get_category_list();\r\n $this->quick_page_setup(Settings_model::$db_config['adminpanel_theme'], 'adminpanel', $this->lang->line('information_update'), 'operation/information_update', 'header', 'footer', '', $content_data);\r\n }", "public function edit($id){\t\n\t\tif($this->input->post('step')=='1'){\n\t\t\t\n\t\t\t$data = array(\n\t\t\t\t'name'=> $this->input->post('name'),\t\t\t\n\t\t\t\t'owner'=> $this->input->post('owner'),\t\t\n\t\t\t\t'address_line'=>$this->input->post('address_line'),\n\t\t\t\t'zip' =>$this->input->post('zip'),\n\t\t\t\t'fax'=>$this->input->post('fax'),\n\t\t\t\t'website'=>$this->input->post('website'),\n\t\t\t\t'working_start'=>$this->input->post('working_start'),\n\t\t\t\t'working_end'=>$this->input->post('working_end'),\n\t\t\t\t'since'=>$this->input->post('since'),\n\t\t\t\t'no_of_employees'=>$this->input->post('no_of_employees'),\n\t\t\t\t'email'=>$this->input->post('email')\n\t\t );\n\t\t}\n\t\tif($this->input->post('step')=='2'){\n\t\t\t\n\t\t\t$data = array(\n\t\t\t\t'description'=> $this->input->post('description'),\t\t\t\n\t\t );\n\t\t}\n\t\tif($this->input->post('step')=='3'){\n\t\t\t$other_info=array('facebook_url'=>$this->input->post('facebook_url'),'googleplus_url'=>$this->input->post('googleplus_url'),'twitter_url'=>$this->input->post('twitter_url'),'linkedin_url'=>$this->input->post('linkedin_url'),'youtube_url'=>$this->input->post('youtube_url'),'whatsup_contact_number'=>$this->input->post('whatsup_contact_number'));\n\t\t\t$other_info=serialize($other_info);\n\t\t\t$data = array(\t\n\t\t\t\t'other_info'=>$other_info\n\t\t\t);\n\t\t}\n\t\tif($this->input->post('step')=='4'){\n\t\t\t$city_id='0';\n\t\t\t$area_id='0';\n\t\t\tif($this->input->post('city')){\t\n\t\t\t\t$city_id=$this->cities_model->cityFindOrSave($this->input->post('city'));\n\t\t\t}\t\n\t\t\tif($this->input->post('area')){\n\t\t\t\t$area_id=$this->areas_model->areaFindOrSave($this->input->post('area'),$city_id);\n\t\t\t}\n\t\t\t$data = array(\n\t\t\t\t'city_name'=> $this->input->post('city_name'),\n\t\t\t\t'area_name'=> $this->input->post('area_name'),\n\t\t\t\t'city_id'=> $city_id,\t\t\t\t\n\t\t\t\t'area_id'=> $area_id,\n 'latitude'=> $this->input->post('latitude'),\n\t\t\t\t'longitude'=> $this->input->post('longitude')\t\n\t\t );\n\t\t}\n\t\tif($this->input->post('step')=='5'){\n\t\t\t$data = array(\n\t\t\t\t'description'=> $this->input->post('description'),\t\t\t\n\t\t );\n\t\t}\n\t\t$this->db->where('id', $id);\n\t\t$this->db->update('advertisements', $data);\n\t}", "public function add_additional_page_settings($data){\n }", "public function add_additional_page_settings($data){\n }", "function a_edit() {\n\t\t$id = isset($_GET[\"id\"]) ? $_GET[\"id\"] : 0;\n\t\t$u=new Gestionnaire($id);\n\t\textract($u->data);\t\n\t\trequire $this->gabarit;\n\t}", "public static function save($id = null) {\n global $lC_Database;\n\n $link = explode('/', $_GET['content_page'], 2);\n $group = (isset($_GET['group']) && $_GET['group'] != null) ? $_GET['group'] : $_GET['group_new'];\n\n if ( is_numeric($id) ) {\n $Qlayout = $lC_Database->query('update :table_templates_boxes_to_pages set templates_boxes_id = :templates_boxes_id, content_page = :content_page, boxes_group = :boxes_group, sort_order = :sort_order, page_specific = :page_specific where id = :id');\n $Qlayout->bindInt(':id', $id);\n } else {\n $Qlayout = $lC_Database->query('insert into :table_templates_boxes_to_pages (templates_boxes_id, templates_id, content_page, boxes_group, sort_order, page_specific) values (:templates_boxes_id, :templates_id, :content_page, :boxes_group, :sort_order, :page_specific)');\n $Qlayout->bindInt(':templates_id', $link[0]);\n }\n $Qlayout->bindInt(':templates_boxes_id', $_GET['box']);\n $Qlayout->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES);\n $Qlayout->bindValue(':content_page', $link[1]);\n $Qlayout->bindValue(':boxes_group', $group);\n $Qlayout->bindInt(':sort_order', $_GET['sort_order']);\n $Qlayout->bindInt(':page_specific', ($_GET['page_specific'] == 'on') ? '1' : '0');\n $Qlayout->setLogging($_SESSION['module'], $id);\n $Qlayout->execute();\n\n if ( !$lC_Database->isError() ) {\n lC_Cache::clear('templates_' . $_GET['set'] . '_layout');\n\n return true;\n }\n\n return false;\n }", "function wiki_edit_page($page_id, $title, $description, $notes, $hide_posts, $meta_keywords, $meta_description, $member = null, $edit_time = null, $add_time = null, $views = null, $null_is_literal = false)\n{\n if (is_null($edit_time)) {\n $edit_time = $null_is_literal ? null : time();\n }\n\n $pages = $GLOBALS['SITE_DB']->query_select('wiki_pages', array('*'), array('id' => $page_id), '', 1);\n if (!array_key_exists(0, $pages)) {\n warn_exit(do_lang_tempcode('MISSING_RESOURCE', 'wiki_page'));\n }\n $page = $pages[0];\n $_description = $page['description'];\n $_title = $page['title'];\n\n $log_id = log_it('WIKI_EDIT_PAGE', strval($page_id), get_translated_text($_title));\n if (addon_installed('actionlog')) {\n require_code('revisions_engine_database');\n $revision_engine = new RevisionEngineDatabase();\n $revision_engine->add_revision(\n 'wiki_page',\n strval($page_id),\n strval($page_id),\n get_translated_text($_title),\n get_translated_text($_description),\n $page['submitter'],\n $page['add_date'],\n $log_id\n );\n }\n\n $update_map = array(\n 'hide_posts' => $hide_posts,\n 'notes' => $notes,\n );\n\n $update_map['edit_date'] = $edit_time;\n if (!is_null($add_time)) {\n $update_map['add_date'] = $add_time;\n }\n if (!is_null($views)) {\n $update_map['wiki_views'] = $views;\n }\n if (!is_null($member)) {\n $update_map['submitter'] = $member;\n } else {\n $member = $page['submitter'];\n }\n\n require_code('attachments2');\n require_code('attachments3');\n\n $update_map += lang_remap('title', $_title, $title);\n $update_map += update_lang_comcode_attachments('description', $_description, $description, 'wiki_page', strval($page_id), null, $member);\n\n $GLOBALS['SITE_DB']->query_update('wiki_pages', $update_map, array('id' => $page_id), '', 1);\n\n require_code('seo2');\n seo_meta_set_for_explicit('wiki_page', strval($page_id), $meta_keywords, $meta_description);\n\n if (post_param_integer('send_notification', null) !== 0) {\n dispatch_wiki_page_notification($page_id, 'EDIT');\n }\n\n if ((addon_installed('commandr')) && (!running_script('install')) && (!get_mass_import_mode())) {\n require_code('resource_fs');\n generate_resource_fs_moniker('wiki_page', strval($page_id));\n }\n\n require_code('sitemap_xml');\n notify_sitemap_node_edit('_SEARCH:wiki:browse:' . strval($page_id), has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'wiki', strval($page_id)));\n}" ]
[ "0.5812104", "0.5788417", "0.55732936", "0.5558033", "0.5508501", "0.5402871", "0.5398554", "0.5334725", "0.5328521", "0.5320023", "0.5309222", "0.53046715", "0.5304608", "0.5256626", "0.5219225", "0.52150357", "0.51836276", "0.5168734", "0.5168008", "0.51613855", "0.51561135", "0.5141888", "0.5129629", "0.51243013", "0.51010543", "0.50940835", "0.50940835", "0.5094058", "0.5079984", "0.507949" ]
0.6002827
0
Get the berry with the referenced flavor.
public function getBerry(): Berry { return $this->berry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setFlavorRef($flavorRef)\n {\n return $this->set('flavorRef', $flavorRef);\n }", "public function getBlueprint() {\n return $this->blueprint;\n }", "public function getBewallet()\n {\n return $this->bewallet;\n }", "public function getBrand()\n\t{\n\t\t$Brand = new Product_Brand();\n\t\treturn $Brand->findItem( array( 'Id = '.$this->Brand ) );\n\t}", "public function show($id)\n {\n return Brewery::findOrFail($id);\n }", "public function carBrand()\n {\n return parent::getBrand();\n }", "public function getBrandById($id)\n {\n return Brand::find($id);\n }", "public function getBlueprint($path) {\n $blueprints = $this->toObjects();\n // If the blueprint does not exist then return null\n // As blueprints may change over time we don't throw an exception\n if (!isset($blueprints[$path])) { return null; }\n // Return the found blueprint object\n return $blueprints[$path];\n }", "public function blueprint()\n {\n return $this->belongsTo('App\\Models\\Blueprint');\n }", "public function getBrand()\n {\n return $this->brand;\n }", "public function getBrand()\n {\n return $this->brand;\n }", "public static function get($class)\n {\n return ModelBlueprint::exists($class) ? ModelBlueprint::$blueprints[$class] : null;\n }", "public function getExistingBranchForTestCase()\n {\n $branchName = $this->getDevBranchName();\n $devBranch = new DevBranches($this->getDefaultClient());\n\n $branches = $devBranch->listBranches();\n $branch = null;\n // get branch detail\n foreach ($branches as $branchItem) {\n if ($branchItem['name'] === $branchName) {\n $branch = $branchItem;\n }\n }\n if (!isset($branch)) {\n $this->testCase->fail(sprintf('Reuse existing branch: branch %s not found.', $branchName));\n }\n\n return $branch;\n }", "public function getBranchesBranch()\n {\n return $this->hasOne(Branches::className(), ['branch_id' => 'branches_branch_id']);\n }", "function get_brand($id) {\n return $this->db->get_where('brands', array('id' => $id))->row_array();\n }", "function getFlavors()\r\n{\r\n return array(\"grasshopper\",\"maple\",\"carrot\", \"caramel\",\"velvet\",\"lemon\",\"tiramisu\");\r\n}", "public function getBrandById($id);", "public function getFeaturedbrand(){\n\t\t \n\t\t $collections = Mage::getModel('brand/brand')->getCollection()\n\t\t\t\t\t\t->addFieldToFilter('is_feature',1);\n\t\t\t\t\n\t\treturn $collections;\n\t }", "public function getCarBrands();", "public function getImageBo()\r\n\t{\r\n\t\treturn $this->ImageBo;\r\n\t}", "public function getBranch()\n {\n return $this->hasOne(CompanyBranches::className(), ['BranchID' => 'BranchID']);\n }", "public function getBranch()\n {\n return $this->branch;\n }", "public function getBranch()\n {\n return $this->branch;\n }", "public function getBairro()\n\t{\n\t\t/**\n\t\t * retorna bairro.\n\t\t * @return bairro\n\t\t */\t\t\n\t\treturn $this->bairro;\n\t}", "public function getBrandFound()\n\t{\n\t\treturn $this->brandFound;\n\t}", "public function getBranch()\n {\n return $this->_options['branch'];\n }", "public function getBrand()\n {\n $brandAttribute = $this->helper->getBrandConfig();\n\n return $this->getAttribute($brandAttribute);\n }", "public function getBrightness()\n {\n if (isset($this->a_State['bri']))\n {\n return($this->a_State['bri']);\n } /* if */\n else\n {\n return(null);\n } /* else */\n }", "public static function getBithumb(){\n $bithumbConfig = Setting::getValue('bithumb');\n if(empty($bithumbConfig['api']) || empty($bithumbConfig['secret']) ){\n $bithumbConfig['api']='';\n $bithumbConfig['secret']='';\n }\n $bithumb = new BithumbClient($bithumbConfig['api'], $bithumbConfig['secret']);\n return $bithumb;\n }", "public function show(Flavor $flavor)\n {\n return view('flavors.show', compact('flavor'));\n }" ]
[ "0.5789121", "0.55683446", "0.5425306", "0.54249614", "0.5416171", "0.53708035", "0.53600264", "0.5308344", "0.53020996", "0.52651674", "0.52651674", "0.5187404", "0.5176655", "0.51710093", "0.5169752", "0.5163356", "0.514269", "0.5126189", "0.5102067", "0.50918275", "0.50918174", "0.5041297", "0.5041297", "0.50018966", "0.49978495", "0.49939358", "0.4992032", "0.49913037", "0.49628282", "0.49602696" ]
0.66842926
0
Get all provider keys.
public function getProviderKeys(): array { return array_keys($this->config['providers']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAllKey();", "public function getProviders();", "public function getProviders();", "public function getProviderNames();", "public function retrieveKeys()\n {\n return $this->start()->uri(\"/api/key\")\n ->get()\n ->go();\n }", "public function getKeys() {}", "function getAllKeys() {\n return $this->memcached->getAllKeys();\n }", "public function getKeys() {\n\t\treturn $this->getAllKeys();\n\t}", "public function getProvider()\n {\n return [\n [\n [],\n [],\n '/'\n ],\n [\n ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'],\n ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'],\n '/'\n ],\n [\n 'value1',\n ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'],\n '/key1'\n ],\n ];\n }", "public function getKeys();", "public function keypathProvider()\n {\n return [[[]]];\n }", "public function getActiveServiceProviderList()\n {\n return array_keys($this->activeProviders);\n }", "abstract public function getProviders();", "protected function getProviderLookup()\n {\n // to skip loading those providers completely.\n return array_merge($this->providerLookup, [\n 'keycloak' => KeycloakProvider::class\n ]);\n }", "public function getKeys()\n {\n $response = $this->get('user/keys');\n\n return $response['public_keys'];\n }", "static function getKeys();", "public function getKeys()\n {\n $private_key = $this->config->getAppValue($this->appName, \"privatekey\");\n $public_key = $this->config->getAppValue($this->appName, \"publickey\");\n\n return [$private_key, $public_key];\n }", "public function provides() {\n $providers = array();\n foreach ($this->providers as $key => $value) {\n $providers[] = $key;\n }\n return $providers;\n }", "public static function get_providers() {\n\t\treturn self::$providers;\n\t}", "public function getKeys() {\n\t\treturn $this->config->getKeys();\n\t}", "abstract public function getKeys();", "public function get_providers()\n {\n }", "public function keys();", "public function keys();", "public function keys();", "public function keys();", "public function keys();", "public function keys();", "public function getProviders(): array\n {\n return $this->providers;\n }", "public function getProviders(): array\n {\n return $this->providers;\n }" ]
[ "0.7434844", "0.70270675", "0.70270675", "0.6984621", "0.69273", "0.69063944", "0.6888709", "0.6882201", "0.6858453", "0.67454326", "0.6735779", "0.66732335", "0.666168", "0.6645941", "0.6609066", "0.66000277", "0.65987337", "0.6579623", "0.65228564", "0.65209067", "0.64908344", "0.6486685", "0.64743495", "0.64743495", "0.64743495", "0.64743495", "0.64743495", "0.64743495", "0.6441594", "0.6441594" ]
0.8154769
0
Deactivate User so they will no longer be displayed in the manage users page is accessed. (Will only be called if user has no access for 180 days)
private function deactivate_user($id) { //Update user table $query = "UPDATE users SET deactivated='1' WHERE id='$id'"; $update_database = mysqli_query($this->con, $query); //Insert into User History for Documentation $employee_id = $this->check_employee_id($id); $query = "INSERT INTO user_history (employee_id, access_prior, access_after, updated_by, note) VALUES ('$employee_id','0', '0', 'System', 'Account Deactivated due to 180 days of No Access.')"; $insert_database = mysqli_query($this->con, $query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _deactivate_user() {\n\t\t$sql=\"SELECT GROUP_CONCAT(id_user) as id FROM \".TABLE_PREFIX.\"user WHERE DATEDIFF(current_date(),last_login) = \".$this->_input['day'].\" AND id_admin <> 1 \";\n\t\t$ids= getsingleindexrow($sql);\n\t\tif($this->_input['day'] && $this->_input[\"flag\"] == 1){\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr['user_status']=0;\n\t\t\t $this->obj_user->update_this(\"user\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"meme\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"reply\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"caption\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t print \"Succesfully Done\";\n\t\t }else{\n\t\t\t print \"No user found\";\n\t\t\t exit;\n\t\t }\n\t\t }else{\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr=explode(\",\", $ids['id']);\n\t\t\t for($x=0;$x<count($arr);$x++){\n\t\t\t $del=$this->unlink_files($arr[$x]);\n\t\t\t }\n\t\t\t $this->obj_user->deleteuser($ids['id']);\n\t\t }\n\t\t}\n\t}", "public function deactivate($id)\n {\n $user = User::find($id);\n $user->user_status=\"Inactive\";\n $user->save();\n return redirect()->route('userdisp');\n }", "function deactivateUser()\n {\n // Sets the value of activated to no\n $int = 0;\n\n $mysqli = $this->conn;\n\n /* Prepared statement, stage 1: prepare */\n if (!($stmt = $mysqli->prepare(\"UPDATE User SET\n \t\t\tactiveUser = ?\n \t\t\t\tWHERE ID = ?\"))\n ) {\n echo \"Prepare failed: (\" . $mysqli->errno . \") \" . $mysqli->error;\n }\n\n /* Prepared statement, stage 2: bind and execute */\n\n if (!($stmt->bind_param(\"ii\",\n $int,\n $this->id))\n ) {\n echo \"Binding parameters failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n if (!$stmt->execute()) {\n echo \"Execute failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n }", "public function disable_user(User $user)\n {\n $this->authorize('disable_user', User::class);\n $user->active = 0;\n $user->save();\n\n if($user->verify_if_current_user_account_is_disabled())\n {\n auth()->logout();\n return redirect('/');\n }\n\n return redirect()->route('edit_user_path', $user->id);\n }", "public function deactivateUser($userId)\n {\n return $this->start()->uri(\"/api/user\")\n ->urlSegment($userId)\n ->delete()\n ->go();\n }", "function deactivateUser($userid)\n {\n $data= array(\n 'status' => 0\n );\n $this->db->where('id', $userid);\n $this->db->update('user', $data);\n }", "public function closeUser()\n {\n $this->isUser = false;\n }", "public function deactivate($id) {\n $this->authorize('deactivate', $this->model);\n $this->model->deactivateUser($id);\n Controller::FlashMessages('The user has been deactivated', 'danger');\n return redirect('/users');\n }", "public function deactivate($username);", "public function actionDeactivate($id){\n $user = Users::findOne($id);\n if($user){\n $user->active = 0;\n foreach(PostServices::find()->where(['owner_id'=>$id])->each() as $post){\n $post->active = 0;\n $post->save();\n }\n if($user->save()){\n \\Yii::$app->session->setFlash('message', 'User deactivated successfully.');\n return $this->redirect(\\Yii::$app->request->referrer);\n }\n\n }\n }", "public function deactivate($id)\n {\n /* find user */\n $user = User::find($id);\n\n /* revoke user from oauth */\n $client = Client::where('user_id', $user->id);\n $client_update = array('revoked' => true);\n $client->update($client_update);\n\n Mail::to($user->email)\n ->send(new UserDeactivated($user));\n\n /* trash user */\n $user->delete();\n\n return response()->json(['success' => 'OK']);\n\n }", "public function actionLogout() {\r\n\r\n if (Yii::app()->user->getstate('user_id')) {\r\n $aduser = AdminUser::model()->findByPk(Yii::app()->user->getstate('user_id'));\r\n $aduser->login_status = 0;\r\n $aduser->last_logged_out = date(\"Y-m-d H:i:s\", strtotime(\"now\"));\r\n $aduser->save(FALSE);\r\n }\r\n\r\n Yii::app()->user->logout();\r\n $this->redirect(Yii::app()->params->logoutUrl);\r\n }", "protected function switchUserBack() {\n if ($this->isUserSwitched) {\n $this->accountSwitcher->switchBack();\n $this->isUserSwitched = FALSE;\n }\n }", "public function disableTwoFactorAuth()\n {\n if (! Authy::isEnabled($this->theUser)) {\n return redirect()->route('profile')\n ->withErrors(trans('app.2fa_not_enabled_for_this_user'));\n }\n\n Authy::delete($this->theUser);\n\n $this->theUser->save();\n\n event(new TwoFactorDisabled);\n\n return redirect()->route('profile')\n ->withSuccess(trans('app.2fa_disabled'));\n }", "public function disable()\n {\n $user = User::where('idPerson', '=', \\Auth::user()->idPerson)->first();\n $user->status = 2;\n $user->confirmation_code = NULL;\n $user->save();\n return Redirect::to('logout');\n }", "public function deactivateUser($user_id)\n\t{\n\t\tif($this->getUserStatusId($user_id) === 2 || $this->getUserStatusId($user_id) === 1)\n\t\t{\n\t\t\t$this->where('id', '=', $user_id)->update(['user_status' => 3]);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "private function userUnblock()\n\t{\n\t\t// Make sure the payment is complete\n\t\tif($this->state != 'C') return;\n\t\t\n\t\t// Make sure the subscription is enabled\n\t\tif(!$this->enabled) return;\n\t\t\n\t\t// Paid and enabled subscription; enable the user if he's not already enabled\n\t\t$user = JFactory::getUser($this->user_id);\n\t\tif($user->block) {\n\t\t\t// Check the confirmfree component parameter and subscription level's price\n\t\t\t// If it's a free subscription do not activate the user.\n\t\t\tif(!class_exists('AkeebasubsHelperCparams')) {\n\t\t\t\trequire_once JPATH_ADMINISTRATOR.'/components/com_akeebasubs/helpers/cparams.php';\n\t\t\t}\n\t\t\t$confirmfree = AkeebasubsHelperCparams::getParam('confirmfree', 0);\n\t\t\tif($confirmfree) {\n\t\t\t\t$level = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')\n\t\t\t\t\t->getItem($this->akeebasubs_level_id);\n\t\t\t\tif($level->price < 0.01) {\n\t\t\t\t\t// Do not activate free subscription\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$updates = array(\n\t\t\t\t'block'\t\t\t=> 0,\n\t\t\t\t'activation'\t=> ''\n\t\t\t);\n\t\t\t$user->bind($updates);\n\t\t\t$user->save($updates);\n\t\t}\n\t}", "public function deactivate() {\n\t\t\t// just in case I want to do anyting on deactivate\n\t\t}", "private function deactivateUser($conn){\n\t\t\t$postdata = file_get_contents(\"php://input\");\n\t\t\t$request = json_decode($postdata);\n\t\t\t$user_id = $request->user_id; \n\t\t\tif($user_id > 0){\n\t\t\t\t$query = 'Update users set user_status = 1 WHERE user_id = '.$user_id;\t\t\t\n\t\t\t\t$sql = $conn->query($query); \n\t\t\t\t$query2 = 'SELECT playlist_id FROM playlist where user_id = '.$user_id;\n\t\t\t\t$sql2 = $conn->query($query2);\n\t\t\t\tif($sql2->num_rows > 0){\n\t\t\t\t\t$result = $sql2->fetch_assoc();\n\t\t\t\t\t$query3 = 'Update playlist set playlist_status = 1 WHERE playlist_id = '.$result['playlist_id'];\t\t\t\n\t\t\t\t\t$sql3 = $conn->query($query3);\n\t\t\t\t\t$query4 = 'Update rel_playlist_tracks set rel_playlist_tracks_status = 1 WHERE playlist_id = '.$result['playlist_id'];\n\t\t\t\t\t$sql4 = $conn->query($query4); \n\t\t\t\t\t$this->response('',200);\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t$this->response('',204);\n\t\t\t\t\n\t\t\t}else\n\t\t\t\t$this->response('',204); \n\t\t}", "function deactivate() {\n \n $this->reset_caches();\n $this->ext->update_option( 'livefyre_deactivated', 'Deactivated: ' . time() );\n\n }", "public function deactivateUser()\n {\n $subscritpionData = $this->Subscription->find('all', array('conditions' => array('Subscription.is_active' => 0, 'Subscription.next_subscription_date' => date('Y-m-d'))));\n foreach ($subscritpionData as $subscription) {\n $nextDate = $subscription['Subscription']['next_subscription_date'];\n if (date('Y-m-d') == $nextDate) {\n $this->User->id = $subscription['Subscription']['user_id'];\n $this->User->saveField('deactivated_by_user', 1);\n $businessId = $this->BusinessOwner->findByUserId($subscription['Subscription']['user_id']);\n \n //Store previous group members information\n $gdata = $this->BusinessOwner->getMyGroupMemberList($this->Encryption->decode($businessId['Group']['id']),$subscription['Subscription']['user_id']);\n $prevMember = NULL;\n $prevRecord['PrevGroupRecord'] = array();\n foreach($gdata as $key => $val) {\n $data['user_id'] = $subscription['Subscription']['user_id'];\n $data['group_id'] = $this->Encryption->decode($businessId['Group']['id']);\n $data['members_id'] = $key;\n array_push($prevRecord['PrevGroupRecord'],$data);\n }\n $this->PrevGroupRecord->saveAll($prevRecord['PrevGroupRecord']); \n $this->BusinessOwner->id = $this->Encryption->decode($businessId['BusinessOwner']['id']);\n $parts = explode(',', $businessId['Group']['group_professions']); \n while(($i = array_search($businessId['BusinessOwner']['profession_id'], $parts)) !== false) {\n unset($parts[$i]);\n }\n $updateProfessions = implode(',', $parts);\n $updateMember = $businessId['Group']['total_member'] - 1;\n\t\t\t\t$this->BusinessOwner->saveField('group_id', NULL);\n $this->Group->updateAll(array('Group.group_professions' => \"'\".$updateProfessions.\"'\",'Group.total_member' =>\"'\".$updateMember.\"'\"),array( 'Group.id' => $businessId['BusinessOwner']['group_id']));\n }\n }\n }", "public function unconfirmed_account() {\n \n // Check if the current user is admin and if session exists\n $this->check_session();\n \n if ( $this->user_status == 1 ) {\n \n redirect('/user/app/dashboard');\n \n }\n \n // Show unconfirmed account page\n $this->load->view('user/unconfirmed-account');\n \n }", "function deactivate($uID=\"\") {\n if(!$uID) {\n echo \"Need uID to deactivate!! - error dump from User_class.php\";\n exit;\n }\n $SQL = \"UPDATE User \".\n \"SET Active = '0' \".\n \"WHERE ID = $uID\";\n mysqli_query($this->db_link, $SQL);\n\n }", "public function deactivate();", "public function logoutUser() {\n $this->session->unsetSession(self::$storedUserId);\n $this->session->setFlashMessage(2);\n self::$isLoggedIn = false;\n }", "protected function makeUserInactive($userModel)\n {\n $userModel->setIsActive(static::DATA_IS_INACTIVE);\n $userModel->getResource()->save($userModel);\n }", "public function deactivate()\n {\n $project = $this->getProject();\n $recovery_plan_id = $this->request->getIntegerParam('recovery_plan_id', 0);\n\n\n $this->response->html($this->template->render('status:recoveryPlanDetail/makeInactive', array(\n 'title' => t('Remove recovery plan'),\n 'project_id' => $project['id'],\n 'values' => array('id' => $recovery_plan_id)\n )));\n }", "public function deactivateUserAction($userActionId)\n {\n return $this->start()->uri(\"/api/user-action\")\n ->urlSegment($userActionId)\n ->delete()\n ->go();\n }", "public function disconnetUser() {\n\t\tsession_start();\n\t\tunset($_SESSION['id_users']);\n\t\tunset($_SESSION['username']);\n\t\theader('Location: index.php');\n\t}", "public function destroy()\n {\n $userId = Helper::getIdFromUrl('user');\n \n if ((Helper::checkUrlIdAgainstLoginId($userId)) !== 'super-admin') {\n Usermodel::load()->destroy($userId);\n } else { \n View::render('errors/403.view', [\n 'message' => 'You cannot delete yourself!',\n ]);\n }\n }" ]
[ "0.6963564", "0.6935043", "0.6856261", "0.6852787", "0.68121284", "0.67821443", "0.6718867", "0.67051685", "0.66214716", "0.65922475", "0.6584458", "0.6561433", "0.65479505", "0.6547784", "0.65232265", "0.6419346", "0.6373802", "0.63685125", "0.63394564", "0.6334459", "0.63097805", "0.629905", "0.62683564", "0.6260811", "0.6251472", "0.6248759", "0.62297684", "0.62241554", "0.62137854", "0.62130314" ]
0.74709094
0
Preprocesses the input stream.
abstract public function preprocessInputStream(string $input): void;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function preProcess() {}", "public static function pre_process() {}", "public function preProcess();", "public function preProcess();", "abstract protected function _preProcess();", "public function rewind()\n {\n $this->stream->rewind();\n\n // read one line as we do in the constructor\n if ($this->header) {\n $this->header = $this->read();\n }\n }", "function init() {\n\t\t$this->processIncomingData();\n\t}", "protected function preprocessData() {}", "function read_stream(){\n global $array_stream;\n $array_key = 0;\n $array_stream = stream_get_contents(STDIN);\n $array_stream = str_split($array_stream);\n\n foreach ($array_stream as $keyMod => $valueMod) { //cut white space before .IPPcode19 header\n if(preg_match('/^\\S$/', $valueMod)){\n break;\n } else unset($array_stream[$keyMod]);\n }\n if(empty($array_stream)){\n fwrite(STDERR, \"ERROR : Input doesn't start with .IPPcode19 header\\n\");\n exit(21);#appropriate exit code\n }\n global $key_val;\n global $c_commentary;\n $c_commentary = 0;\n $key_val = $keyMod;\n }", "public function preProcessRequest(RequestInterface &$request) {}", "protected function readInput() : void {\n\t\t\tif ($this->input === null) {\n\t\t\t\ttry {\n\t\t\t\t\tif (($this->input = @file_get_contents(\"php://input\")) === false) {\n\t\t\t\t\t\t$this->input = '';\n\t\t\t\t\t}\n\t\t\t\t} catch (\\Exception $ex) {\n\t\t\t\t\t$this->input = '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}", "private function _preLoadReset() {\n\t\t$this->_amountProcessedLines = $this->_amountReadLines = 0;\n\t\t$this->_linesInvalidSize = $this->_lines = [];\n\t}", "public function init()\n {\n $this->processInput();\n $this->outputFile();\n }", "public function preProcess($object);", "protected function processInput()\n {\n if (empty($this->input)) {\n $this->input = request()->except('_token');\n\n if ($this->injectUserId) {\n $this->input['user_id'] = Auth::user()->id;\n }\n }\n $this->sanitize();\n request()->replace($this->input); // @todo IS THIS NECESSARY?\n }", "function preProcess()\n {\t\n parent::preProcess( );\n\t\t \n\t}", "public function setUp() {\n $depend= $this->filter();\n if (!in_array($depend, stream_get_filters())) {\n throw new PrerequisitesNotMetError(ucfirst($depend).' stream filter not available', null, [$depend]);\n }\n }", "protected function _preload() {\n }", "public function onBuildFromIterator(PreBuildFromIteratorEvent $event)\n {\n $event->setIterator(\n new ProcessorIterator(\n $event->getIterator(),\n $this->processor,\n $event->getBase()\n )\n );\n }", "function onBeforeStream(&$man, $cmd, $input) {\r\n\t\treturn true;\r\n\t}", "public function resolveInput()\n {\n $value = $this->_value( @$_SERVER['CONTENT_TYPE'], '' );\n $value = $this->_value( @$_SERVER['HTTP_CONTENT_TYPE'], $value );\n $value = $this->_value( @$_SERVER['HTTP_X_CONTENT_TYPE'], $value );\n $parts = array();\n\n if( !empty( $value ) )\n {\n $value = 'ctype='. $value;\n $value = preg_replace( '/\\;\\s+/', '&', $value );\n parse_str( $value, $parts );\n }\n $this->ctype = $this->_value( @$parts['ctype'], '' );\n $this->boundary = $this->_value( @$parts['boundary'], '' );\n $this->input = trim( file_get_contents( 'php://input' ) );\n }", "function __construct(){\n $this->stdin = fopen('php://stdin', 'r');\n $this->commentsNumber = 0;\n do{\n $line = utf8_encode($this->readLine()); //mozna ne encode tady musim otestovat\n if(preg_match('/#/', $line)){\n $this->iterateComments();\n } \n $line = preg_replace('/\\s*/','', $line); \n }while($line == null && !feof($this->stdin));\n if(strtolower($line) != \".ippcode18\"){\n exit(21);\n }\n }", "protected function connectInput()\n {\n $this->input_handle = fopen($this->input_filepath, 'r');\n }", "protected function preProcessRecordData(&$data)\n {\n }", "private function headerRead(): void\n {\n if (false === $this->getStrategy()->hasHeader() || true === $this->headerRead) {\n return;\n }\n\n $this->rewind();\n $this->skipLeadingLines();\n $this->header = $this->normalizeHeader($this->convertRowToUtf8($this->current()));\n $this->headerRead = true;\n $this->next();\n }", "abstract protected function _preHandle();", "public function preFlush(): void\n {\n $this->setParams(clone $this->getParams());\n }", "protected function preprocessInternal()\n\t{\n\t\t// void\n\t}", "protected function _preProcess(\\SetaPDF_Core_Document $pdfDocument) {}", "function _pre() {\n\n\t}" ]
[ "0.6401543", "0.62233925", "0.6172487", "0.6172487", "0.6024839", "0.60180485", "0.59495956", "0.5867547", "0.5641567", "0.56222886", "0.5604959", "0.55110306", "0.5509075", "0.5491158", "0.54185945", "0.54065216", "0.5406473", "0.53696454", "0.53464806", "0.5319898", "0.5317344", "0.5302889", "0.526701", "0.52269286", "0.5221942", "0.5206203", "0.5198517", "0.5185623", "0.5168722", "0.51621133" ]
0.74403566
0
Initialization hook method. Use this method to add common initialization code like loading components. e.g. `$this>loadComponent('Security');`
public function initialize() { parent::initialize(); $this->loadComponent('RequestHandler'); $this->loadComponent('Flash'); /* * Enable the following components for recommended CakePHP security settings. * see https://book.cakephp.org/3.0/en/controllers/components/security.html */ //$this->loadComponent('Security'); //$this->loadComponent('Csrf'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Cookie', [\n 'expires' => Configure::read('Config.CookieExpires'),\n 'httpOnly' => true\n ]);\n $this->loadComponent('Common');\n $this->loadComponent('Auth', array(\n 'loginRedirect' => false,\n 'logoutRedirect' => false,\n 'loginAction' => array(\n 'controller' => 'customers',\n 'action' => 'login',\n 'plugin' => null\n ),\n 'sessionKey' => 'Auth.ChoTreo'\n ));\n }", "public function initialize()\n\t{\n\t\tparent::initialize();\n\t\t$this->loadComponent('Paginator');\n\t\t$this->loadComponent('Flash'); // Inclusion of the FlashComponent\n\n\n\t}", "public function initialize() {\r\n\t\tparent::initialize();\r\n\t\t\r\n\t\t// load mediawiki api component\r\n\t\t$this->loadComponent( 'MediawikiAPI' );\r\n\t\t$this->loadComponent( 'PasswordGenerator' );\r\n\t\t$this->loadComponent( 'EmailSending' );\r\n\t}", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Auth', [\n 'authorize' => 'Controller',\n 'loginAction' => [\n 'controller' => 'Users',\n 'action' => 'login',\n ],\n 'loginRedirect' => [\n 'controller' => 'Users',\n 'action' => 'index/',\n ],\n 'logoutRedirect' => [\n 'controller' => 'Booking',\n 'action' => 'index',\n ],\n 'authError' => 'Enregistrez-vous ou Connectez-vous',\n 'authenticate' => [\n 'Form' => [\n 'fields' => ['username' => 'Email', 'password' => 'Password']\n ]\n ]\n ]\n );\n\n /*\n * Enable the following components for recommended CakePHP security settings.\n * see https://book.cakephp.org/3.0/en/controllers/components/security.html\n */\n //$this->loadComponent('Security');\n //$this->loadComponent('Csrf');\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n\n $this->loadComponent('Acl', [\n 'className' => 'Acl.Acl'\n ]);\n $this->loadComponent('CakeDC/Users.UsersAuth');\n\n // if ($this->Auth->user('role_id') == 'e687cb91-4cdf-4ab2-992f-e76584199c2e') {\n // var_dump('Redirect');\n // $this->Auth->config('loginRedirect',['controller'=>'articles','action'=>'index']);\n // }\n\n /*\n * Enable the following components for recommended CakePHP security settings.\n * see https://book.cakephp.org/3.0/en/controllers/components/security.html\n */\n //$this->loadComponent('Security');\n //$this->loadComponent('Csrf');\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler');\n $this->loadComponent('Flash');\n $this->loadComponent('Auth', ['authenticate' =>\n ['ADmad/JwtAuth.Jwt' => [\n 'parameter' => 'token',\n 'userModel' => 'Sessions',\n 'fields' => [\n 'username' => 'username'\n ],\n 'scope' => ['Sessions.status' => 1],\n 'queryDatasource' => true\n ]\n ],'storage' => 'Memory',\n 'checkAuthIn' => 'Controller.initialize',\n 'loginAction' => false,\n 'unauthorizedRedirect' => false]);\n $this->loadComponent('Paginator');\n $this->loadComponent('BryanCrowe/ApiPagination.ApiPagination',[\n 'visible' => [\n 'page',\n 'current',\n 'count',\n 'perPage',\n 'prevPage',\n 'nextPage'\n ]\n ]);\n }", "public function init()\n {\n $this->loadThemeComponent();\n $this->loadConfig();\n }", "public function init() {\n\n // Set required classes for import.\n $this->setImport(array(\n $this->id . '.components.*',\n $this->id . '.components.behaviors.*',\n $this->id . '.components.dataproviders.*',\n $this->id . '.controllers.*',\n $this->id . '.models.*',\n ));\n\n // Set the required components.\n $this->setComponents(array(\n 'authorizer' => array(\n 'class' => 'RAuthorizer',\n 'superuserName' => $this->superuserName,\n ),\n 'generator' => array(\n 'class' => 'RGenerator',\n ),\n ));\n }", "public function initialize()\n {\n parent::initialize();\n $this->loadHelper('Auth');\n }", "private function init() {\n\n\t\tif ( ! $this->should_load() ) {\n\t\t\treturn;\n\t\t}\n\t\t$this->setup_admin();\n\t\t$this->setup_api();\n\t}", "function _initialize()\n {\n\n //initalize Loader\n $auto_load=array(\"io\",\"segment\",\"router\");\n \n foreach($auto_load as $library)\n {\n $this->$library=& load_class($library);\n }\n //load loader class\n $this->load =& load_class('Loader');\n \n //call auto load from config file\n $this->load->_auto_load();\n }", "public function init() {\n\t\t// you may place code here to customize the module or the application\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'common.components.*',\n\t\t));\n\t}", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('RequestHandler',[ 'enableBeforeRedirect' => false ]);\n $this->loadComponent('Flash');\n\n $this->loadComponent('Auth',[\n\n //'authorize' => ['Controller'],\n\n 'loginAction' => '/login',\n 'loginRedirect' => '/',\n 'logoutRedirect' => '/login',\n\n 'authenticate' => [\n 'Form' => [\n 'fields' => [\n 'username' => 'email',\n 'password' => 'password' \n ]\n ]\n ],\n 'loginAction' => [\n 'controller' => 'users',\n 'action' => 'login'\n ],\n\n 'storage' => 'Session'\n ]);\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'yiiauth.models.*',\n\t\t\t'yiiauth.components.*',\n\t\t));\n\t}", "public function initialize() {\n $this->add_hooks_and_filters();\n }", "public static function Initialize() {\n\n Debugger::debugMessage('Registering components register');\n self::ComponentsRegister();\n }", "public function initialize()\n {\n parent::initialize();\n\n $this->loadComponent('Auth', [\n 'storage' => 'Memory',\n 'authenticate' => [\n 'Form' => [\n //'scope' => ['Users.active' => 1],\n 'fields' => [\n 'username' => 'username',\n 'password' => 'password'\n ]\n ],\n 'ADmad/JwtAuth.Jwt' => [\n 'parameter' => 'token',\n 'userModel' => 'users',\n //'scope' => ['Users.active' => 1],\n 'fields' => [\n 'username' => 'username'\n ],\n 'queryDatasource' => true\n ]\n ],\n 'unauthorizedRedirect' => false,\n 'checkAuthIn' => 'Controller.initialize',\n 'loginAction' => false,\n 'authError' => 'server:api.auth_controller.error.authentication'\n ]);\n }", "public function init()\n\t{\n\t\t$this->resolvePackagePath();\n\t\t$this->registerCoreScripts();\n\t\tparent::init();\n\t}", "protected function __onInit()\n\t{\n\t}", "public function initialize()\n {\n $autoloader = $this->registerAutoloader();\n $this->registerPlugins($autoloader);\n }", "public function initialize()\n {\n // load configures\n $this->_config = $this->di->get('config');\n\n if ($this->_config->logger->enable)\n $this->_logger = $this->di->get('logger');\n\n // set default page title\n $this->tag->setTitle('Authenticate');\n }", "public static function _init() {\n // this is called upon loading the class\n }", "public function init()\n\t{\n\t\t// you may place code here to customize the module or the application\n\n\t\t// import the module-level models and components\n\t\t$this->setImport(array(\n\t\t\t'clinics.models.*',\n\t\t\t'clinics.components.*',\n\t\t));\n\t}", "public function loadInit() {}", "public function _before_init(){}", "public static function _init()\n {\n \\Module::load('authentication');\n }", "public function init()\n {\n // you may place code here to customize the module or the application\n }", "protected function init(): void\n {\n //\n }", "private function __construct() {\r\n $this->initHooks();\r\n }", "protected function init() {\n }" ]
[ "0.7946912", "0.7773577", "0.77526087", "0.7741109", "0.771082", "0.7704803", "0.76974875", "0.7584935", "0.7526934", "0.7523755", "0.74972165", "0.74754775", "0.74528354", "0.74457645", "0.7434708", "0.7425733", "0.7389886", "0.73864573", "0.73737717", "0.7363953", "0.7363841", "0.7363051", "0.731293", "0.7309179", "0.7292775", "0.7291819", "0.7288227", "0.7282642", "0.72796", "0.7237755" ]
0.8072819
0
Data provider for testVote(). These transitions should never be allowed because the Task status is not compliant.
public function providerTestVote() { return array( // No user may ever start any Task if the Task has no resource. array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is finished. array(Task::STATUS_FINISHED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is sent to the client. array(Task::STATUS_SENT, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), // No user may ever re-assign any Task if it is archived. array(Task::STATUS_ARCHIVED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function providerTestVoteAsResource()\n {\n return array(\n // Resources are allowed to accept a Task that is assigned to them.\n array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_GRANTED),\n // Resources are not allowed to directly start on a new Task.\n // It needs to explicitly have the \"assigned\" status.\n array(Task::STATUS_NEW, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED),\n // Resources are allowed to send in their completed work.\n array(Task::STATUS_STARTED, Task::STATUS_FINISHED, StatusVoter::ACCESS_GRANTED),\n );\n }", "public function testVote($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $voter = $this->createVoter();\n $task = new Task();\n $task->setStatus($currentStatus);\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testTask()\n {\n $task = new Task();\n $user = new User();\n\n $this->assertNull($task->getId());\n $task->setTitle('test');\n $this->assertSame('test', $task->getTitle());\n $task->setContent('testcontent');\n $this->assertSame('testcontent', $task->getContent());\n $task->toggle(true);\n $this->assertTrue( $task->isDone());\n $task->setUser($user);\n $this->assertInstanceOf(User::class, $task->getUser());\n $task->setCreatedAt(new \\DateTime());\n $this->assertNotEmpty($task->getCreatedAt());\n }", "public function testTriggerCanControlScheduledTasks() {\n AuthenticationHelper::login(\"[email protected]\", \"password\");\n\n $dataSetInstanceSummary = new DatasetInstanceSummary(\"Test dataset\", \"test-json\", null, [], [], []);\n $instanceId = $this->datasetService->saveDataSetInstance($dataSetInstanceSummary, null, 1);\n\n $snapshotProfileSummary = new DatasetInstanceSnapshotProfileSummary(\"Summary Adhoc\", \"tabulardatasetsnapshot\", [\n ], DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n\n $now = (new \\DateTime())->format(\"Y-m-d H:i:s\");\n $id = $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n $snapshotProfileSummary->setId($id);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $snapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n $this->assertEquals([], $snapshotProfile->getScheduledTask()->getTimePeriods());\n\n\n // Check we can change snapshot to scheduled\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE);\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(null, 5, 20, 33)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $scheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n /**\n * @var ScheduledTask $task\n */\n $task = $scheduledSnapshotProfile->getScheduledTask();\n $this->assertEquals(\"dataprocessor\", $task->getTaskIdentifier());\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $scheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(null, 5, 20, 33, $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n\n // Alter this scheduled snapshot\n $snapshotProfileSummary->setTitle(\"New Title\");\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(3, null, 4, 1)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $newScheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $newScheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(3, null, 4, 1, $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n // Check we can revert to adhoc\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $adhocSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $adhocSnapshotProfile->getTrigger());\n $this->assertEquals([], $adhocSnapshotProfile->getScheduledTask()->getTimePeriods());\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "public function testStaleVotes()\n {\n // create review to test with\n $review = new Review($this->p4);\n $review->setParticipants(array('foo', 'bar'))\n ->set('author', 'joe')\n ->save();\n\n // add several versions\n $review->setVersions(\n array(\n array('change' => 2, 'user' => 'joe', 'time' => 700, 'pending' => 1, 'difference' => 1),\n array('change' => 3, 'user' => 'joe', 'time' => 710, 'pending' => 1, 'difference' => 1),\n array('change' => 4, 'user' => 'joe', 'time' => 720, 'pending' => 1, 'difference' => 2),\n )\n )->save();\n\n // prepare connections for users 'foo', 'bar'\n $p4Foo = $this->connectWithAccess('foo', array('//...'));\n $p4Bar = $this->connectWithAccess('bar', array('//...'));\n $userFoo = User::fetch('foo', $this->p4);\n $userBar = User::fetch('bar', $this->p4);\n\n // test that voting without version applies to latest\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST');\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(3, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // try voting on a particular version\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Foo)\n ->setService('user', $userFoo);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 2)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/up');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(1, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n\n // vote as 'bar' on version 1 and verify its evaluated as stale vote\n $this->resetApplication();\n $services = $this->getApplication()->getServiceManager();\n $services->setService('p4_user', $p4Bar)\n ->setService('user', $userBar);\n $this->getRequest()->setMethod('POST')->setPost(new Parameters(array('version' => 1)));\n $this->dispatch('/reviews/' . $review->getId() . '/vote/down');\n\n $votes = Review::fetch($review->getId(), $this->p4)->getVotes();\n $this->assertSame(2, count($votes));\n $this->assertSame(1, $votes['foo']['value']);\n $this->assertSame(2, $votes['foo']['version']);\n $this->assertSame(false, $votes['foo']['isStale']);\n $this->assertSame(-1, $votes['bar']['value']);\n $this->assertSame(1, $votes['bar']['version']);\n $this->assertSame(true, $votes['bar']['isStale']);\n }", "public function transitionsProvider()\n {\n $needsReview = 'needsReview';\n $needsRevision = 'needsRevision';\n $approved = 'approved';\n $approvedCommit = 'approved:commit';\n $rejected = 'rejected';\n $archived = 'archived';\n\n // prepare some transition sets\n $allStates = array(\n $needsReview,\n $needsRevision,\n $approved,\n $approvedCommit,\n $rejected,\n $archived\n );\n $allTransitions = array(\n $needsReview => array_diff($allStates, array($needsReview)),\n $needsRevision => array_diff($allStates, array($needsRevision)),\n $approved => array_diff($allStates, array($approved)),\n $rejected => array_diff($allStates, array($rejected)),\n $archived => array_diff($allStates, array($archived))\n );\n $allButApprovedTransitions = array(\n $needsReview => array_diff($allStates, array($needsReview, $approved, $approvedCommit)),\n $needsRevision => array_diff($allStates, array($needsRevision, $approved, $approvedCommit)),\n $approved => array_diff($allStates, array($approved)),\n $rejected => array_diff($allStates, array($rejected, $approved, $approvedCommit)),\n $archived => array_diff($allStates, array($archived, $approved, $approvedCommit))\n );\n $noTransitions = array(\n $needsReview => false,\n $needsRevision => false,\n $approved => false,\n $rejected => false,\n $archived => false\n );\n $memberOnlyTransitions = array(\n $needsReview => array($needsRevision),\n $needsRevision => array($needsReview),\n $approved => array($needsReview, $needsRevision, $approvedCommit),\n $rejected => array(),\n $archived => array(),\n );\n\n // tests sub-array 'asserts' contains user to authenticate as in key and array\n // of [<reviewState> => <list of expected transitions>] in value\n return array(\n 'no-projects' => array(\n 'projects' => array(),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allTransitions,\n 'b' => $allTransitions\n ),\n ),\n // verify that author cannot approve if self-approve is disabled\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allButApprovedTransitions,\n 'b' => $allTransitions\n ),\n ),\n )\n ),\n 'no-mods-single' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n ),\n ),\n ),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'a' => $allTransitions\n ),\n ),\n // verify that author cannot approve if self-approve is disabled\n array(\n 'reviewAuthor' => 'a',\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewFiles' => array('//depot/a/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'b' => $allTransitions,\n 'a' => $allButApprovedTransitions\n ),\n ),\n ),\n ),\n 'no-mods-multi' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n ),\n ),\n array(\n 'id' => 'prj2',\n 'members' => array('a', 'c'),\n 'branches' => array(\n array(\n 'id' => 'b',\n 'name' => 'B',\n 'paths' => '//depot/b/...',\n 'moderators' => array()\n ),\n ),\n ),\n array(\n 'id' => 'prj3',\n 'members' => array('x', 'y', 'z'),\n 'branches' => array(\n array(\n 'id' => 'c',\n 'name' => 'C',\n 'paths' => '//depot/c/...',\n 'moderators' => array()\n ),\n ),\n ),\n ),\n 'tests' => array(\n // test review touching projects 1 & 3\n // members: [a, b, x, y, z]\n // moderators: []\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/c/file'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'c' => $noTransitions,\n 'a' => array(\n $needsReview => array_diff($allStates, array($needsReview))\n ),\n 'y' => array(\n $needsReview => array_diff($allStates, array($needsReview))\n ),\n ),\n ),\n ),\n ),\n 'with-mods-single' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b', 'c'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array('m1', 'm2')\n )\n )\n ),\n ),\n 'tests' => array(\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/x/foo'),\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'a' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n ),\n ),\n ),\n 'with-mods-multi' => array(\n 'projects' => array(\n array(\n 'id' => 'prj1',\n 'members' => array('a', 'b', 'c'),\n 'branches' => array(\n array(\n 'id' => 'a',\n 'name' => 'A',\n 'paths' => '//depot/a/...',\n 'moderators' => array('m1', 'a')\n ),\n ),\n ),\n array(\n 'id' => 'prj2',\n 'members' => array('joe'),\n 'branches' => array(\n array(\n 'id' => 'a2',\n 'name' => 'A2',\n 'paths' => '//depot/a/...',\n 'moderators' => array()\n ),\n array(\n 'id' => 'b',\n 'name' => 'B',\n 'paths' => '//depot/b/...',\n 'moderators' => array('joe')\n ),\n ),\n ),\n array(\n 'id' => 'prj3',\n 'members' => array('x', 'y', 'z'),\n 'branches' => array(\n array(\n 'id' => 'c',\n 'name' => 'C',\n 'paths' => '//depot/c/...',\n 'moderators' => array('x', 'm2')\n ),\n ),\n ),\n ),\n 'tests' => array(\n // test review touching projects 1 & 2\n // members: [a, b, c, joe]\n // moderators: [m1, a]\n array(\n 'reviewFiles' => array('//depot/a/file', '//depot/x/foo'),\n 'reviewAuthor' => 'joe',\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'joe' => array(\n $needsReview => array($needsRevision, $archived),\n $needsRevision => array($needsReview, $archived),\n $approved => array($needsReview, $needsRevision, $approvedCommit, $archived),\n $rejected => array(),\n $archived => array($needsReview, $needsRevision)\n ),\n 'a' => $allTransitions,\n 'b' => $memberOnlyTransitions,\n 'm1' => $allTransitions,\n 'm2' => $noTransitions\n ),\n ),\n // test author as the only moderator\n array(\n 'reviewFiles' => array('//depot/b/file'),\n 'reviewAuthor' => 'joe',\n 'asserts' => array(\n 'foo' => $noTransitions,\n 'joe' => $allTransitions\n ),\n ),\n // test author as one of many moderators\n array(\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allTransitions,\n 'b' => $memberOnlyTransitions,\n 'c' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n ),\n // verify that authors who are also moderators cannot approve their own reviews\n array(\n 'config' => array('reviews' => array('disable_self_approve' => true)),\n 'reviewFiles' => array('//depot/a/file'),\n 'reviewAuthor' => 'a',\n 'asserts' => array(\n 'a' => $allButApprovedTransitions,\n 'b' => $memberOnlyTransitions,\n 'c' => $memberOnlyTransitions,\n 'm1' => $allTransitions\n ),\n )\n ),\n ),\n );\n }", "public function reviewTask ($task) {\n\n\t}", "public function testCreateTask()\n {\n }", "public function testVoteAsResource($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $user = new User();\n\n $token->expects($this->once())\n ->method('getUser')\n ->willReturn($user);\n\n $roleHierarchy = $this->getMock('Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface');\n $voter = new StatusVoter($roleHierarchy);\n\n $task = new Task();\n $task->setStatus($currentStatus);\n $task->setResource($user);\n\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testGetTaskInstanceVariable()\n {\n }", "public function testPatchReviewerRequiredToggle()\n {\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('nonadmin', true, 'required')->addVote('nonadmin', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'nonadmin' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'nonadmin' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost(new Parameters(array('required' => false)))\n ->setQuery(new Parameters(array('_method' => 'patch')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n\n\n // now try using patch and setting it to required\n $expected['nonadmin'] = array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_PATCH)\n ->setPost(new Parameters(array('required' => '1')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testCreateTaskVariable()\n {\n }", "public function testTestStatus()\n {\n // create review record for change 1\n $this->createChange();\n $review = Review::createFromChange('1')->save();\n\n // ensure starting test status of null.\n $this->assertSame($review->get('testStatus'), null);\n\n // dispatch and check output\n $this->dispatch('/reviews/2/tests/fail/' . $review->getToken());\n $result = $this->getResult();\n $review = Review::fetch(2, $this->p4);\n $this->assertRoute('review-tests');\n $this->assertResponseStatusCode(200);\n $this->assertSame(true, $result->getVariable('isValid'));\n $this->assertSame('fail', $review->get('testStatus'));\n }", "public function test_user_cannot_both_upvote_and_downvote() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n $this->message->upvote($user);\n $this->message->downvote($user);\n $this->assertEquals(0, $this->message->getUpvotes());\n $this->assertEquals(1, $this->message->getDownvotes());\n\n $this->message->downvote($user);\n $this->message->upvote($user);\n $this->assertEquals(1, $this->message->getUpvotes());\n $this->assertEquals(0, $this->message->getDownvotes());\n\n }", "public function testVote()\n {\n $vote = new Vote();\n $this\n ->voteDirector\n ->expects($this->any())\n ->method('findOneBy')\n ->will($this->returnValue(null));\n\n $this\n ->voteDirector\n ->expects($this->once())\n ->method('create')\n ->will($this->returnValue($vote));\n\n $this\n ->commentEventDispatcher\n ->expects($this->once())\n ->method('dispatchCommentOnVotedEvent')\n ->with(\n $this->equalTo($this->comment),\n $this->equalTo($vote),\n $this->equalTo(false)\n );\n\n $vote = $this\n ->voteManager\n ->vote(\n $this->comment,\n $this->authorToken,\n Vote::DOWN\n );\n\n $this->assertSame($this->authorToken, $vote->getAuthorToken());\n $this->assertSame($this->comment, $vote->getComment());\n $this->assertSame(Vote::DOWN, $vote->getType());\n }", "public function vote_active() { \n\n\t\t/* Going to do a little more here later */\n\t\tif ($this->type == 'vote') { return true; } \n\n\t\treturn false;\n\n\t}", "public function voteDesicionAftetVote(Request $request)\n {\n $this->validate($request, [\n 'election_id' => 'required',\n 'pin' => 'required',\n 'session_id' => 'required',\n 'random_number' => 'required',\n ]);\n $session_id = trim($request->session_id); ;\n $pin = trim($request->pin);\n $election_id = trim($request->election_id);\n $random_number = trim($request->random_number);\n $confirm_button = trim($request->confirm_button);\n if($confirm_button == 'not_ok')\n {\n // remove the field\n DB::table('tbl_temp_vote')->where('voter_id',$this->voter_id)->delete();\n Session::put('succes','Thanks , Your Vote Cancel. Again Given Vote');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit();\n }\n if($confirm_button == 'ok')\n {\n $vote_date_time_confim = DB::table('tbl_vote_schedule')->where('election_id',$election_id)->where('status',0)->first();\n // voting time ended\n date_default_timezone_set('Asia/Dhaka');\n $current_date = date('Y-m-d');\n $current_time = date('H:i:s');\n $e_start_date = $vote_date_time_confim->start_date ;\n $e_start_time = $vote_date_time_confim->start_time ;\n $e_end_date = $vote_date_time_confim->end_date ;\n $e_end_time = $vote_date_time_confim->end_time ;\n\n if($current_date == $e_start_date AND $current_time > $e_start_time){\n $date_time_status = '1' ;\n }\n elseif($current_date > $e_start_date AND $current_date < $e_end_date){\n $date_time_status = '1' ;\n }elseif($current_date == $e_end_date AND $current_time < $e_end_time){\n $date_time_status = '1' ; \n }else{\n $date_time_status = '2' ; \n }\n if($date_time_status == '2'){\n Session::put('failed','Sorry ! Voting Time Is Expired');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit(); \n }\n\n // count already vote cast\n $count = DB::table('tbl_final_vote')->where('election_id',$election_id)->where('voter_id',$this->voter_id)->count();\n if($count > 0){\n Session::put('failed','Sorry ! Sorry You Are Already Given Vote');\n return Redirect::to('choseCandidateType/'.$election_id.'/'.$pin);\n exit(); \n }\n // insert data into final vote\n $result = DB::table('tbl_temp_vote')->where('election_id',$election_id )->where('voter_id',$this->voter_id)->where('pin_no',$pin)->where('session_id',$session_id)->where('random_number',$random_number)->get();\n foreach ($result as $value) {\n $data_insert = array();\n $data_insert['election_id'] = $election_id ;\n $data_insert['post_id'] = $value->post_id ;\n $data_insert['candidate_id'] = $value->candidate_id ;\n $data_insert['voter_id'] = $this->voter_id ;\n $data_insert['pin_no'] = $value->pin_no ;\n $data_insert['session_id'] = $value->session_id ;\n $data_insert['created_time'] = $this->current_time;\n $data_insert['created_at'] = $this->rcdate ;\n DB::table('tbl_final_vote')->insert($data_insert);\n }\n DB::table('tbl_temp_vote')->where('voter_id',$this->voter_id)->delete();\n Session::put('succes','Thanks , Finaly Your Vote Count Sucessfully');\n return Redirect::to('/voterDashboard');\n }\n }", "public function testUpdateTaskInstanceVariable()\n {\n }", "function user_vote()\n{\n\n // nonce check for an extra layer of security, the function will exit if it fails\n if (!wp_verify_nonce($_REQUEST['nonce'], \"user_vote_nonce\")) {\n exit(\"nonce error\");\n }\n\n $post_id = $_REQUEST[\"post_id\"];\n $vote_direction = $_REQUEST[\"vote_direction\"];\n\n // fetch vote_count for a post, set it to 0 if it's empty, increment it when a click is registered\n $old_vote_count = get_post_meta($post_id, \"votes\", true);\n $old_vote_count = ($old_vote_count == '') ? 0 : $old_vote_count;\n $new_vote_count = $old_vote_count;\n\n //voted post structure\n //$voted_posts = array(\"1\" => 0, \"5\" => 1, \"7\" => -1);\n\n $previous_vote_direction = get_vote_direction_meta($post_id);\n //if previous vote in middle regular vote apply: $previous_vote_direction == 0\n\n //if vote remove: $vote_direction == $previous_vote_direction\n // add negative vote direction to old vote count\n // set vote direction to middle\n\n //if vote swap: $vote_direction != $previous_vote_direction\n // add 2 times vote directions to old vote count\n // set vote meta to vote direction\n\n if($previous_vote_direction == 0){\n $new_vote_count += $vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }elseif ($vote_direction == $previous_vote_direction){\n $new_vote_count = $old_vote_count - $vote_direction;\n set_user_vote_direction($post_id, 0);\n }elseif ($vote_direction != $previous_vote_direction){\n $new_vote_count = $old_vote_count + 2*$vote_direction;\n set_user_vote_direction($post_id, $vote_direction);\n }\n\n\n $vote = update_post_meta($post_id, \"votes\", $new_vote_count);\n\n\n // If above action fails, result type is set to 'error' and vote_count set to old value, if success, updated to new_vote_count\n if ($vote === false) {\n $result['type'] = \"error\";\n $result['vote_count'] = $old_vote_count;\n } else {\n $result['type'] = \"success\";\n $result['vote_count'] = $new_vote_count;\n }\n\n // Check if action was fired via Ajax call. If yes, JS code will be triggered, else the user is redirected to the post page\n if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {\n $result = json_encode($result);\n echo $result;\n } else {\n header(\"Location: \" . $_SERVER[\"HTTP_REFERER\"]);\n }\n\n die();\n}", "public function testShiftTasksOpenOnly() {\n\t\t$milestone1_pre = $this->Milestone->findById(1);\n\t\t$milestone3_pre = $this->Milestone->findById(3);\n\n\t\t$this->assertEqual($milestone1_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_pre['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\n\t\t// Shift only the non-resolved/closed tasks and check all is well\n\t\t$this->Milestone->shiftTasks(1, 3, false, array('callbacks' => false));\n\n\t\t$milestone1_post = $this->Milestone->findById(1);\n\t\t$milestone3_post = $this->Milestone->findById(3);\n\t\t$this->assertEqual($milestone1_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '1', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '0', 'points' => '0'),\n\t\t));\n\t\t$this->assertEqual($milestone3_post['Tasks'], array(\n\t\t\t'open' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'in progress' => array('numTasks' => '2', 'points' => '0'),\n\t\t\t'resolved' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'closed' => array('numTasks' => '0', 'points' => '0'),\n\t\t\t'dropped' => array('numTasks' => '1', 'points' => '0'),\n\t\t));\n\t}", "public function testUsersTotpToggle()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function testGetParliamentaryCandidateWithVoteCast()\n {\n $pollingStation = $this->em->getRepository('VtallyBundle:PollingStation')->find(1);\n $candidates = $pollingStation->getParliamentaryCandidateWithVoteCast();\n $this->assertEquals($candidates[0]->getFirstName(), 'Jhon');\n $this->assertEquals($candidates[0]->getVoteCast(), 100);\n $this->assertEquals($candidates[1]->getFirstName(), 'Jannette');\n $this->assertEquals($candidates[1]->getVoteCast(), 280);\n $this->assertEquals($candidates[2]->getFirstName(), 'Sondra');\n $this->assertEquals($candidates[2]->getVoteCast(), 98);\n $this->assertEquals($candidates[3]->getFirstName(), 'Fadde');\n $this->assertEquals($candidates[3]->getVoteCast(), 0);\n $this->assertEquals($candidates[4]->getFirstName(), 'Vivien');\n $this->assertEquals($candidates[4]->getVoteCast(), 100);\n $this->assertEquals($candidates[5]->getFirstName(), 'Joella');\n $this->assertEquals($candidates[5]->getVoteCast(), 7);\n $this->assertEquals($candidates[6]->getFirstName(), 'Adde');\n $this->assertEquals($candidates[6]->getVoteCast(), 2);\n }", "public function testStatusConfirm()\n {\n\n }", "public function testGeTaskVariableData()\n {\n }", "public function getTestStatus()\n {\n switch ($this->getData('status')) {\n case 0:\n return 'Stopped';\n case 1:\n return 'Running';\n case 2:\n return 'Paused';\n }\n }" ]
[ "0.5794929", "0.5588812", "0.5467419", "0.5263082", "0.52602094", "0.52524436", "0.5204949", "0.51966316", "0.5148624", "0.50911164", "0.50904775", "0.50476503", "0.49787313", "0.4977462", "0.49705684", "0.49591023", "0.4955093", "0.49067727", "0.49023867", "0.48859265", "0.48224607", "0.4800443", "0.4777392", "0.47764802", "0.47623825", "0.4759799", "0.47492978", "0.4742493", "0.47420943", "0.4732615" ]
0.69030195
0
Data provider for testVoteAsResource(). These test workflow transitions that apply to users being logged in and attempting the transition on a Task to which they are the assigned resource.
public function providerTestVoteAsResource() { return array( // Resources are allowed to accept a Task that is assigned to them. array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_GRANTED), // Resources are not allowed to directly start on a new Task. // It needs to explicitly have the "assigned" status. array(Task::STATUS_NEW, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED), // Resources are allowed to send in their completed work. array(Task::STATUS_STARTED, Task::STATUS_FINISHED, StatusVoter::ACCESS_GRANTED), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function providerTestVote()\n {\n return array(\n // No user may ever start any Task if the Task has no resource.\n array(Task::STATUS_ASSIGNED, Task::STATUS_STARTED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is finished.\n array(Task::STATUS_FINISHED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is sent to the client.\n array(Task::STATUS_SENT, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n // No user may ever re-assign any Task if it is archived.\n array(Task::STATUS_ARCHIVED, Task::STATUS_ASSIGNED, StatusVoter::ACCESS_DENIED),\n );\n }", "public function testVoteAsResource($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $user = new User();\n\n $token->expects($this->once())\n ->method('getUser')\n ->willReturn($user);\n\n $roleHierarchy = $this->getMock('Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface');\n $voter = new StatusVoter($roleHierarchy);\n\n $task = new Task();\n $task->setStatus($currentStatus);\n $task->setResource($user);\n\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function testPostVoteOnQuestion(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $url = \"/api/questions/$q->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n //down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n // down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testGetTaskInstanceIdentityLinks()\n {\n }", "public function test_users_vote_can_be_retrieved() {\n\n $user = User::create('[email protected]', 'secret', 'Jane Doe');\n\n $this->assertNull($this->message->getVote($user));\n\n $this->message->upvote($user);\n $this->assertEquals('up', $this->message->getVote($user));\n\n $this->message->downvote($user);\n $this->assertEquals('down', $this->message->getVote($user));\n\n }", "public function testVote($currentStatus, $newStatus, $expectedAccessResult)\n {\n $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');\n $voter = $this->createVoter();\n $task = new Task();\n $task->setStatus($currentStatus);\n $this->assertEquals($expectedAccessResult, $voter->vote($token, $task, array($newStatus)));\n }", "public function voteForResource(\\TYPO3\\Flow\\Security\\Context $securityContext, $resource)\n {\n }", "public function test_a_user_can_vote_for_a_post()\n {\n $user = $this->defaultUser();\n\n $post = $this->createPost();\n\n $this->browse(function (Browser $browser) use($user,$post) {\n $browser->loginAs($user)\n ->visit($post->url)\n ->pressAndWaitFor('+1')\n ->assertSeeIn('current-vote',1);\n });\n }", "public function testGetTaskInstanceVariable()\n {\n }", "public function testTask()\n {\n $task = new Task();\n $user = new User();\n\n $this->assertNull($task->getId());\n $task->setTitle('test');\n $this->assertSame('test', $task->getTitle());\n $task->setContent('testcontent');\n $this->assertSame('testcontent', $task->getContent());\n $task->toggle(true);\n $this->assertTrue( $task->isDone());\n $task->setUser($user);\n $this->assertInstanceOf(User::class, $task->getUser());\n $task->setCreatedAt(new \\DateTime());\n $this->assertNotEmpty($task->getCreatedAt());\n }", "public function testCreateTaskInstanceIdentityLinks()\n {\n }", "public function testSeeTaskButton()\n {\n $user = User::first();\n $project = $user->projects()->first();\n \\Auth::login($user);\n $response = $this->actingAs($user)->get('/projects/'.$project->id);\n $response->assertSee(__(\"project.add_task\"));\n }", "function testMarkAsVoted() {\n\t\t/*\n\t\t$mobilePoll = $this->ObjFromFixture('Poll', 'mobile-poll');\n\t\t$mobilePoll->markAsVoted();\n\t\t$this->assertTrue($mobilePoll->hasVoted());\n\t\t*/\n\t}", "public function test_a_user_can_toggle_posts(){\n \n //we have a signed in user\n \n //user likes the model\n $this->post->toggle();\n\n $this->assertTrue($this->post->isLiked());\n\n $this->post->toggle();\n\n $this->assertFalse($this->post->isLiked());\n }", "public function testAuthorizeOperationOnResourceTypeFail()\n {\n // set up environment variables (current user is not signed in and currently is work time)\n $this->currentUserId = null;\n $this->currentUserRole = null;\n $this->isWorkTime = true;\n $policyEnforcement = $this->createPolicyEnforcementPoint();\n\n // send authorization request\n $authRequest = new Request([\n RequestProperties::REQUEST_OPERATION => Posts::OPERATION_CREATE,\n RequestProperties::REQUEST_RESOURCE_TYPE => Posts::RESOURCE_TYPE,\n ]);\n\n // we expect it to fail because operation `create` is not defined in Policies.\n $this->assertFalse($policyEnforcement->authorize($authRequest));\n $this->assertFalse(static::$obligationCalled);\n $this->assertFalse(static::$adviceCalled);\n }", "public function testvote()\n {\n $this->vote_answer = Vote::vote($this->user->id, $this->answer->id, 1, 'answer_id');\n if (!$this->answer) return false;\n }", "public function testPostVoteOnAnswer(): void {\n $user = factory(User::class)->create();\n $q = factory(Question::class)->create();\n $a = factory(Answer::class)->create(['question_id' => $q->id]);\n $url = \"/api/answers/$a->id\";\n //up and cancel\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'up' => 0]);\n // down and cancel\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 0, 'down' => 0]);\n //down up down\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n $this->post(url(\"$url/upvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => 1, 'up' => 1]);\n $this->post(url(\"$url/downvote\"), ['api_token' => $user->api_token])\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1, 'down' => 1]);\n\n $this->get(url(\"$url/votes\"))\n ->assertStatus(200)\n ->assertJsonFragment(['total' => -1]);\n }", "public function testPatchReviewerRequiredToggle()\n {\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('nonadmin', true, 'required')->addVote('nonadmin', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'nonadmin' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'nonadmin' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost(new Parameters(array('required' => false)))\n ->setQuery(new Parameters(array('_method' => 'patch')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n\n\n // now try using patch and setting it to required\n $expected['nonadmin'] = array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_PATCH)\n ->setPost(new Parameters(array('required' => '1')));\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers/nonadmin');\n $this->assertRoute('review-reviewer');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $review = $result->getVariable('review');\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // proccess all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testAdultUsersCanSeeTaskList()\n {\n $this->withoutExceptionHandling();\n Task::factory(3)->create();\n $adult = User::create([\n 'name' => 'vanessa',\n 'role' => 'adult',\n 'points' => 0,\n 'email' => '[email protected]',\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n 'remember_token' => Str::random(10)\n ]);\n\n $response = $this->actingAs($adult)\n ->get(route('dashboard.tasks'));\n $response->assertStatus(200)\n ->assertViewIs('dashboard.task-list')\n ->assertViewHas('taskList');\n }", "public function testAssignTask()\n {\n // workflow, rule, action and object\n $this->task = factory(TaskEloquent::class)->create([\n 'user_id' => null,\n 'person_id' => null,\n ]);\n\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $this->user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_ASSIGN,\n 'target_class' => '',\n 'target_field' => '',\n 'value' => '',\n 'task_id' =>$this->task->getKey(),\n ]);\n $workflow->actions()->sync([$action1->getKey() ]); //, $action2->getKey()\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $this->tag->getKey(),\n ]);\n\n\n // rule\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'assign task to user',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.stage_id',\n 'value' => $this->stageId,\n 'runnable_once' => 1, // only once\n ]);\n\n $action1->rules()->sync([ $rule1->getKey()]);\n\n // run action runner\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $this->person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $this->person->getKey(), //$leadContext->getKey(),\n 'user_id' => $this->user->getKey(),\n ]);\n\n // check task\n $this->seeInDatabase('tasks',[\n 'id' => $this->task->getKey(),\n 'user_id' => $this->user->getKey(),\n ]);\n\n $this->cleanUpRecords(new PersonObserver, $this->person);\n }", "public function test_that_authorized_user_can_view_courses_within_other_periods()\n {\n \n }", "public function testHaveOneProVoter()\n {\n $strategy = new Affirmative([\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => true\n ],\n 'remove' => [\n 'supports' => true,\n 'granted' => false\n ]\n ]),\n $this->createVoter([\n 'edit' => [\n 'supports' => true,\n 'granted' => false\n ],\n 'remove' => [\n 'supports' => false,\n 'granted' => false\n ]\n ]),\n ]);\n\n self::assertTrue($strategy->isGranted(['edit', 'remove'], null, null));\n }", "public function testUserWithAccesToResource()\n {\n $this->logged();\n $this->visit('/resource')\n ->seePageIs('/resource');\n }", "public function testActionUseCase2()\n {\n // person and target\n\n // workflow, rule and action\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $this->user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'persons',\n 'target_field' => 'is_primary',\n 'value' => 1,\n ]);\n $workflow->actions()->sync([$action1->getKey()]);\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'is preapprove person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_BOOLEAN,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'persons.is_pre_approved',\n 'value' => '1',\n 'runnable_once' => true,\n 'run_interval' => 0,\n ]);\n $rule2 = factory(RuleEloquent::class)->create([\n 'name' => 'lead type own',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.lead_type_id',\n 'value' => $this->leadTypeId,\n ]);\n\n $action1->rules()->sync([ $rule1->getKey(), $rule2->getKey()]); //\n\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $this->tag->getKey(),\n ]);\n // check tag\n $this->seeInDatabase('taggables',[\n 'user_id' => $this->user->getKey(),\n 'tag_id' => $this->tag->getKey(),\n 'taggable_id' => $this->person->getKey(),\n 'taggable_type' => 'persons',\n ]);\n\n //// first time run ////\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n $this->assertEquals($status, 0);\n //$this->assertEquals(1, preg_match('/^Complete fire actions/m', $output->fetch()));\n\n // check logs\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $this->person->getLoggableType(),\n 'object_id' => $this->person->getKey(),\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule1->getKey()\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule2->getKey()\n ]);\n\n //// second run must failed ////\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // // check logs\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_FAILED,\n 'object_class' => $this->person->getLoggableType(),\n 'object_id' => $this->person->getKey(),\n 'info' => 'Already run once!',\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule1->getKey()\n ]);\n $this->seeInDatabase('action_log_rules',[\n 'rule_id' => $rule2->getKey()\n ]);\n\n //cleanup.\n $this->cleanUpRecords(new PersonObserver, $this->person);\n }", "public function testTriggerCanControlScheduledTasks() {\n AuthenticationHelper::login(\"[email protected]\", \"password\");\n\n $dataSetInstanceSummary = new DatasetInstanceSummary(\"Test dataset\", \"test-json\", null, [], [], []);\n $instanceId = $this->datasetService->saveDataSetInstance($dataSetInstanceSummary, null, 1);\n\n $snapshotProfileSummary = new DatasetInstanceSnapshotProfileSummary(\"Summary Adhoc\", \"tabulardatasetsnapshot\", [\n ], DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n\n $now = (new \\DateTime())->format(\"Y-m-d H:i:s\");\n $id = $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n $snapshotProfileSummary->setId($id);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $snapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $snapshotProfile->getTrigger());\n $this->assertEquals([], $snapshotProfile->getScheduledTask()->getTimePeriods());\n\n\n // Check we can change snapshot to scheduled\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE);\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(null, 5, 20, 33)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $scheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n /**\n * @var ScheduledTask $task\n */\n $task = $scheduledSnapshotProfile->getScheduledTask();\n $this->assertEquals(\"dataprocessor\", $task->getTaskIdentifier());\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $scheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(null, 5, 20, 33, $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $scheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n\n // Alter this scheduled snapshot\n $snapshotProfileSummary->setTitle(\"New Title\");\n $snapshotProfileSummary->setTaskTimePeriods([new ScheduledTaskTimePeriod(3, null, 4, 1)]);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $newScheduledSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_SCHEDULE, $newScheduledSnapshotProfile->getTrigger());\n $this->assertEquals(new ScheduledTaskTimePeriod(3, null, 4, 1, $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]->getId()),\n $newScheduledSnapshotProfile->getScheduledTask()->getTimePeriods()[0]);\n\n // Check we can revert to adhoc\n $snapshotProfileSummary->setTrigger(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC);\n $this->datasetService->saveSnapshotProfile($snapshotProfileSummary, $instanceId);\n\n /**\n * @var DatasetInstanceSnapshotProfile $snapshotProfile\n */\n $adhocSnapshotProfile = DatasetInstanceSnapshotProfile::fetch($id);\n\n $this->assertEquals(DatasetInstanceSnapshotProfileSummary::TRIGGER_ADHOC, $adhocSnapshotProfile->getTrigger());\n $this->assertEquals([], $adhocSnapshotProfile->getScheduledTask()->getTimePeriods());\n }", "public function testListTasksInstanceIdentityLinks()\n {\n }", "public function user_can_be_retrieved_with_correct_resource_elements()\n {\n $this\n ->get(\"nova-api/users/{$this->user->id}\")\n ->assertJson([\n 'resource' => [\n 'id' => [\n 'value' => $this->user->id,\n ],\n 'fields' => [\n [\n 'attribute' => 'id',\n 'component' => 'id-field',\n 'name' => 'ID',\n 'sortable' => true,\n 'value' => $this->user->id,\n ],\n [\n 'attribute' => 'email',\n 'component' => 'file-field',\n 'name' => 'Avatar',\n 'value' => null,\n 'thumbnailUrl' => 'https://www.gravatar.com/avatar/'.md5($this->user->email).'?s=300',\n ],\n [\n 'attribute' => 'first_name',\n 'component' => 'text-field',\n 'name' => 'First Name',\n 'sortable' => true,\n 'value' => $this->user->first_name,\n ],\n [\n 'attribute' => 'last_name',\n 'component' => 'text-field',\n 'name' => 'Last Name',\n 'sortable' => true,\n 'value' => $this->user->last_name,\n ],\n [\n 'attribute' => 'email',\n 'component' => 'text-field',\n 'name' => 'Email',\n 'sortable' => true,\n 'value' => $this->user->email,\n ],\n [\n 'attribute' => 'has_notifications_enabled',\n 'component' => 'boolean-field',\n 'name' => 'Has Notifications Enabled',\n 'value' => $this->user->has_notifications_enabled,\n ],\n [\n 'attribute' => 'role',\n 'component' => 'belongs-to-field',\n 'name' => 'Role',\n 'value' => $this->user->role->name,\n ],\n [\n 'attribute' => 'extra_attributes',\n 'component' => 'key-value-field',\n 'name' => 'Extra Attributes',\n 'value' => [],\n ],\n [\n 'component' => 'heading-field',\n 'value' => 'Meta',\n ],\n [\n 'attribute' => 'created_at',\n 'component' => 'date-time',\n 'name' => 'Created At',\n 'value' => $this->user->created_at,\n ],\n [\n 'attribute' => 'updated_at',\n 'component' => 'date-time',\n 'name' => 'Updated At',\n 'value' => $this->user->updated_at,\n ],\n ],\n ],\n ]);\n }", "public function testEditReviewers()\n {\n $user = new User;\n $user->setId('gnicol')->setEmail('[email protected]')->setFullName('gnicol')->save();\n $user->setId('dj')->setEmail('[email protected]')->setFullName('dj')->save();\n\n // create review record for change 1 and prime it with a vote\n $this->createChange();\n Review::createFromChange('1')->save()->updateFromChange('1')\n ->setParticipantData('gnicol', true, 'required')->addVote('gnicol', 1)\n ->save();\n\n // there shouldn't be any tasks but proccess just to be safe\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify the starting state is good\n $this->assertSame(\n array(\n 'admin' => array(),\n 'gnicol' => array(\n 'required' => true, 'vote' => array('value' => 1, 'version' => 1, 'isStale' => false)\n )\n ),\n Review::fetch('2', $this->p4)->getParticipantsData()\n );\n\n $expected = array(\n 'admin' => array(), // as they are the author; can't get rid of em\n 'dj' => array('required' => true),\n 'gnicol' => array('vote' => array('value' => 1, 'version' => 1, 'isStale' => false))\n );\n $postData = new Parameters(\n array(\n 'reviewers' => array('gnicol', 'dj'),\n 'requiredReviewers' => array('dj')\n )\n );\n $this->getRequest()\n ->setMethod(\\Zend\\Http\\Request::METHOD_POST)\n ->setPost($postData);\n\n // dispatch and check output\n $this->dispatch('/reviews/2/reviewers');\n $result = $this->getResult();\n $review = $result->getVariable('review');\n $this->assertRoute('review-reviewers');\n $this->assertResponseStatusCode(200);\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n // @codingStandardsIgnoreStart\n $this->assertSame(true, $result->getVariable('isValid'), print_r($result->getVariables(), true));\n // @codingStandardsIgnoreEnd\n $this->assertSame(\n $expected,\n $review['participantsData']\n );\n\n // process all tasks as they may impact things\n $this->getRequest()->getQuery()->set('debug', 1)->set('retire', 1);\n $this->dispatch('/queue/worker');\n\n // verify participants are still correct\n $review = Review::fetch('2', $this->p4);\n $this->assertSame(\n $expected,\n $review->getParticipantsData()\n );\n }", "public function testActionUseCase3()\n {\n\n // person, user, and target\n $user = factory(UserEloquent::class)->create();\n $person = factory(PersonEloquent::class)->create([\n 'is_pre_approved' => 0,\n 'is_primary' => 0,\n ]);\n $leadTypeId = LeadTypeEloquent::where('label', 'own')->where('user_id', null)->first()->getKey();\n $stageId = StageEloquent::where('label', 'prospect')->where('user_id', null)->first()->getKey();\n $stageLeadId = StageEloquent::where('label', 'lead')->where('user_id', null)->first()->getKey();\n $leadContext = factory(PersonContextEloquent::class)->create([\n 'user_id' => $user->getKey(),\n 'person_id' => $person->getKey(),\n 'stage_id' => $stageId,\n 'lead_type_id' => $leadTypeId,\n ]);\n $tag = TagEloquent::find(10);\n $person->tags()->attach($tag->getKey(), ['user_id' => $user->getKey()]);\n\n // workflow, rule, action and object\n $workflow = factory(WorkflowEloquent::class)->create([\n 'user_id' => $user->getKey(),\n ]);\n $action1 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'persons',\n 'target_field' => 'is_pre_approved',\n 'value' => '1',\n ]);\n $action2 = factory(ActionEloquent::class)->create([\n 'action_type' => ActionEloquent::ACTION_TYPE_UPDATE,\n 'target_class' => 'person_contexts',\n 'target_field' => 'stage_id',\n 'value' => $stageLeadId,\n ]);\n $workflow->actions()->sync([$action1->getKey(), $action2->getKey()]); //\n $object = factory(ObjectEloquent::class)->create([\n 'workflow_id' => $workflow->getKey(),\n 'object_class' => 'tags.id',\n 'object_type' => $tag->getKey(),\n ]);\n\n\n // // parent rule\n $rule1 = factory(RuleEloquent::class)->create([\n 'name' => 'not preapprove person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_BOOLEAN,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'persons.is_pre_approved',\n 'value' => '0'\n ]);\n\n // dependent rule\n $rule2 = factory(RuleEloquent::class)->create([\n 'name' => 'is prospect person',\n 'workflow_id' => $workflow->getKey(),\n 'rule_type' => RuleEloquent::FIELD_TYPE_NUMBER,\n 'operator' => RuleEloquent::OPERATOR_EQUAL,\n 'field_name' => 'person_contexts.stage_id',\n 'value' => $stageId,\n 'parent_id' => $rule1->getKey(),\n ]);\n $action1->rules()->sync([ $rule1->getKey()]);\n $action2->rules()->sync([ $rule2->getKey()]);\n\n\n\n //// first time run ////\n $kernel = $this->app->make(Kernel::class);\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action2->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n //// check should failed /////\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action2->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_FAILED,\n 'object_class' => $person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $person->getKey(), //$leadContext->getKey(),\n 'info' => 'Dependent rule(s) not meet!',\n ]);\n $this->notSeeInDatabase('person_contexts',[\n 'id' => $leadContext->getKey(),\n $action2->target_field => $action2->value,\n ]);\n\n //// second run, run action 1 first /////\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action1->getKey(),\n )),\n $output = new BufferedOutput\n );\n $this->assertEquals($status, 0);\n //echo $output->fetch();\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action1->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $person->getLoggableType(),\n 'object_id' => $person->getKey(),\n ]);\n // check updated by status\n $this->seeInDatabase('persons',[\n 'id' => $person->getKey(),\n $action1->target_field => $action1->value,\n ]);\n\n //// second run, run action 2 then ///\n $status = $kernel->handle(\n $input = new ArrayInput(array(\n 'command' => 'workflow:action-run',\n 'workflow' => $workflow->getKey(),\n 'action' => $action2->getKey(),\n )),\n $output = new BufferedOutput\n );\n //echo $output->fetch();\n $this->assertEquals($status, 0);\n\n // check status\n $this->seeInDatabase('action_logs',[\n 'action_id' => $action2->getKey(),\n 'workflow_id' => $workflow->getKey(),\n 'status' => LogInterface::LOG_STATUS_SUCCESS,\n 'object_class' => $person->getLoggableType(), //$leadContext->getLoggableType(),\n 'object_id' => $person->getKey(), //$leadContext->getKey(),\n ]);\n // check updated by status\n $this->seeInDatabase('person_contexts',[\n 'id' => $leadContext->getKey(),\n $action2->target_field => $action2->value,\n ]);\n\n $this->cleanUpRecords(new PersonObserver, $person);\n }", "public function testApproveAssignmentAsUserSucceeds()\n {\n $request = new \\Request([], ['REQUEST_URI' => \"http://api.dev.joind.in/v2.1/talks/9999/speakers\", 'REQUEST_METHOD' => 'POST']);\n $request->user_id = 2;\n $request->parameters = [\n 'username' => 'janebloggs',\n 'display_name' => 'Jane Bloggs'\n ];\n\n $talks_controller = new \\TalksController();\n $db = $this->getMockBuilder('\\JoindinTest\\Inc\\mockPDO')->getMock();\n\n $talk_mapper = $this->createTalkMapper($db, $request);\n $talk_mapper\n ->expects($this->once())\n ->method('getSpeakerFromTalk')\n ->will(\n $this->returnValue(\n [\n 'speaker_id' => null,\n 'ID' => 1\n ]\n )\n );\n $talk_mapper\n ->expects($this->once())\n ->method('assignTalkToSpeaker')\n ->will($this->returnValue(true));\n $talks_controller->setTalkMapper($talk_mapper);\n\n $user_mapper = $this->createUserMapper($db, $request);\n $user_mapper\n ->expects($this->once())\n ->method('getUserIdFromUsername')\n ->will($this->returnValue(2));\n $talks_controller->setUserMapper($user_mapper);\n\n $pending_talk_claim_mapper = $this->getMockBuilder('\\PendingTalkClaimMapper')\n ->setConstructorArgs(array($db,$request))\n ->getMock();\n $pending_talk_claim_mapper\n ->expects($this->once())\n ->method('claimExists')\n ->will($this->returnValue(\\PendingTalkClaimMapper::HOST_ASSIGN));\n $pending_talk_claim_mapper\n ->expects($this->once())\n ->method('approveAssignmentAsSpeaker')\n ->will($this->returnValue(true));\n\n\n\n $talks_controller->setPendingTalkClaimMapper($pending_talk_claim_mapper);\n\n $event_mapper = $this->createEventMapper($db, $request);\n $talks_controller->setEventMapper($event_mapper);\n\n $this->assertNull($talks_controller->setSpeakerForTalk($request, $db));\n\n }" ]
[ "0.6149578", "0.5842785", "0.5541706", "0.54536754", "0.54156137", "0.53495896", "0.5334247", "0.53201246", "0.5237323", "0.52187735", "0.5212932", "0.5175018", "0.51644707", "0.5163589", "0.51301324", "0.5126221", "0.5121984", "0.50994885", "0.506552", "0.50142", "0.49861038", "0.49703407", "0.4969797", "0.49432567", "0.48808137", "0.48770347", "0.48677066", "0.48629582", "0.48436224", "0.48380268" ]
0.65813416
0
Validate publisher config data.
public function validate($configData);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validateConfig()\n\t{\n\t\t$schemaContent = @file_get_contents(Config::$schemaFile);\n\t\tif($schemaContent === FALSE) {\n\t\t\t$this->errors['File not found'][] = [\n\t\t\t\t'property' => Config::$schemaFile,\n\t\t\t\t'message' => 'Schema file not found.'\n\t\t\t];\n\t\t\treturn;\n\t\t}\n\n\t\t$schema = Json::decode($schemaContent);\n\n\t\t$this->schemaValidator->check($this->config, $schema);\n\n\t\tif (!$this->schemaValidator->isValid()) {\n\t\t\t$this->errors['schema'] = $this->schemaValidator->getErrors();\n\t\t}\n\t}", "public function validate() {\n\n if (empty($this->config['default_pool_read'])) {\n throw new neoform\\config\\exception('\"default_pool_read\" must be set');\n }\n\n if (empty($this->config['default_pool_write'])) {\n throw new neoform\\config\\exception('\"default_pool_write\" must be set');\n }\n\n if (empty($this->config['pools']) || ! is_array($this->config['pools']) || ! $this->config['pools']) {\n throw new neoform\\config\\exception('\"pools\" must contain at least one server');\n }\n }", "public abstract function validateConfig($config);", "public function validateConfig() {\n // Validate the site has default content configuration.\n if (empty($this->defaultContentConfig)) {\n throw new \\Exception(\"No default content configuration exists for current site.\");\n }\n\n // Validate the configuration specifies a valid path.\n if (isset($this->defaultContentConfig['path']) && !is_dir($this->defaultContentConfig['path'])) {\n throw new \\Exception(\"Configured default content path is not a valid directory. Check the site's configuration.\");\n }\n\n // Validate that default entities to export are given.\n if (empty($this->defaultContentConfig['default-entities']) || !is_array($this->defaultContentConfig['default-entities'])) {\n throw new \\Exception(\"Default entities are not properly configured. Ensure entity types are listed.\");\n }\n\n // Validate a proper default_author value is passed.\n if (isset($this->defaultContentConfig['default_author']) && $this->defaultContentConfig['default_author'] != self::DEFAULT_AUTHOR_PRESERVE) {\n if (!is_numeric($this->defaultContentConfig['default_author'])) {\n throw new \\Exception(\"Assigned default_author value is not an integer. Assign to a valid UID.\");\n }\n }\n }", "public function validate()\n\t{\n\t\t$this->errors = [];\n\n\t\t$this->validateConfig();\n\n\t\t// there is no point to continue if config is not valid against the schema\n\t\tif($this->isValid()) {\n\t\t\t$this->validateRepetitions();\n\t\t\t$this->validateMode();\n\t\t\t$this->validateClasses();\n\t\t\t$this->validateTestData();\n\t\t}\n\t}", "private function validateConfig()\n {\n // Throw error when username is missing from the config files.\n if (! config('mailcamp.username')) {\n throw new MailcampException('Mailcamp API error: No username is specified for connecting with Mailcamp.');\n }\n\n // Throw error when token is missing from the config files.\n if (! config('mailcamp.token')) {\n throw new MailcampException('Mailcamp API error: No token is specified for connecting with Mailcamp.');\n }\n\n // Throw error when endpoint is missing from the config files.\n if (! config('mailcamp.endpoint')) {\n throw new MailcampException('Mailcamp API error: No endpoint is specified for connecting with Mailcamp.');\n }\n\n // Set connection details.\n $this->config = new \\stdClass();\n $this->config->username = config('mailcamp.username');\n $this->config->token = config('mailcamp.token');\n $this->config->endpoint = config('mailcamp.endpoint');\n }", "private function _validate_settings()\n\t{\n\n\t\treturn TRUE;\n\t}", "public function isValid($data)\n {\n if (!parent::isValid($data)) {\n return false;\n }\n\n $sourceKey = 'source' . $data['config']['sourceType'];\n if (empty($data['config'][$sourceKey])) {\n $this->getElement($sourceKey)->addError(\n \"You must enter a \" . $this->getElement($sourceKey)->getLabel() . \".\"\n );\n return false;\n }\n return true;\n }", "public function checkConfig();", "public static function checkConfig() {\n\t\tlog::add('surveillanceStation', 'debug', ' ┌──── Verification des configurations du plugin');\n\t\t// Checking snapLocation\n\t\tif (config::byKey('snapLocation', 'surveillanceStation') == 'synology') {\n\t\t\tconfig::save('snapRetention', '', 'surveillanceStation');\n\t\t\tlog::add('surveillanceStation', 'debug', ' │ checkConfig::snapRetention Nettoyage des valeurs');\n\t\t}\n\t\t// Checking Integer fields\n\t\tforeach (array('port', 'snapRetention') as $field) {\n\t\t\tif ( ! empty(config::byKey($field, 'surveillanceStation'))) {\n\t\t\t\tswitch($field) {\n\t\t\t\t\tcase 'port':\n\t\t\t\t\t\t$min_range = 1;\n\t\t\t\t\t\t$max_range = 65535;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$min_range = 0;\n\t\t\t\t\t\t$max_range = 9999;\n\t\t\t\t}\n\t\t\t\tif(!filter_var(config::byKey($field, 'surveillanceStation'), FILTER_VALIDATE_INT, array('options' => array('min_range' => $min_range, 'max_range' => $max_range)))){\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' │ ERROR : checkConfig::'.$field.' est invalide. La configuration doit être un nombre (entier) compris entre '.$min_range.' et '.$max_range);\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' └────────────');\n\t\t\t\t\tthrow new Exception(__($field.' est invalide. La configuration doit être un nombre (entier) compris entre '.$min_range.' et '.$max_range, __FILE__));\n\t\t\t\t} else {\n\t\t\t\t\tlog::add('surveillanceStation', 'debug', ' │ checkConfig::'.$field.' OK with value ' . config::byKey($field, 'surveillanceStation'));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog::add('surveillanceStation', 'debug', ' └────────────');\n }", "public function validateDatabaseConfig(Database_Config $databaseConfig);", "private function validateConfig($config)\n {\n if (!is_array($config)) {\n throw new \\InvalidArgumentException(Constants::BAD_CONFIG_FORMAT_MESSAGE);\n }\n if (!array_key_exists('file_path', $config) && !array_key_exists('json_data', $config)) {\n throw new \\InvalidArgumentException('Config should either contain a `file_path` or `json_data`');\n }\n if (array_key_exists('file_path', $config)) {\n if (!file_exists($config['file_path'])) {\n throw new FileNotFound($config['file_path']);\n }\n $stores_data = file_get_contents($config['file_path']);\n }\n if (array_key_exists('json_data', $config)) {\n $stores_data = $config['json_data'];\n }\n\n $stores = json_decode(\n $stores_data,\n true\n );\n if (!$stores) {\n throw new \\InvalidArgumentException(Constants::INVALID_JSON_DATA_MESSAGE);\n }\n $this->stores = $stores;\n }", "public function validate_config_on_save($host_obj)\n\t\t{\n\t\t\t$public_key = trim($host_obj->public_key);\n\t\t\t$private_key = trim($host_obj->private_key);\n\t\t\t\n\t\t\tif (!strlen($public_key))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['public_key']) || !strlen($host_obj->fetched_data['public_key']))\n\t\t\t\t\t$host_obj->validation->setError('Please enter public key', 'public_key', true);\n\n\t\t\t\t$host_obj->public_key = $host_obj->fetched_data['public_key'];\n\t\t\t}\n\n\t\t\tif (!strlen($private_key))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['private_key']) || !strlen($host_obj->fetched_data['private_key']))\n\t\t\t\t\t$host_obj->validation->setError('Please enter private key', 'private_key', true);\n\n\t\t\t\t$host_obj->private_key = $host_obj->fetched_data['private_key'];\n\t\t\t}\n\t\t}", "public static function validatePlugin()\n {\n if (!file_exists($glueJson = static::$basePath . 'glue.json')) {\n die('The [glue.json] file is missing from \"' . static::$basePath . '\" directory.');\n }\n\n static::$config = json_decode(file_get_contents($glueJson), true);\n\n $configPath = static::$basePath . 'config';\n\n if (!file_exists($file = $configPath . '/app.php')) {\n die('The [config.php] file is missing from \"' . $configPath . '\" directory.');\n }\n\n static::$config = array_merge(include $file, static::$config);\n\n if (!($autoload = @static::$config['autoload'])) {\n die('The [autoload] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n\n if (!($namespace = @$autoload['namespace'])) {\n die('The [namespace] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n\n $namespaceMapping = (array)@$autoload['mapping'];\n\n\n if (!$namespaceMapping) {\n die('The [mapping] key is not specified or invalid in \"' . $glueJson . '\" file.');\n }\n }", "public function validateAndPrepare(){\n if (!isset($this->extras['copyconf-parameters'])) {\n throw new \\InvalidArgumentException('The parameter handler needs to be configured through the extra.copyconf-parameters setting.');\n }\n\n $this->configs = $this->extras['copyconf-parameters'];\n\n if (!is_array($this->configs)) {\n throw new \\InvalidArgumentException('The extra.copyconf-parameters setting must be an array or a configuration object.');\n }\n\n foreach (array('dist_ext', 'reg_exp', 'backup_mode', 'backup_dir') as $var){\n if (isset($this->configs[$var]) && !empty($this->configs[$var])){\n $this->$var = $this->configs[$var];\n }\n }\n }", "public function validate_config_on_load($host_obj)\n\t\t{\n\t\t}", "public function validate_config_on_load($host_obj)\n\t\t{\n\t\t}", "protected function validateConfigurationOptions()\n {\n if (empty($this->dataKeys)) {\n throw new MissConfiguredException(__('There are not columns specified for your datatable.'));\n }\n\n if (empty($this->configColumns)) {\n throw new MissConfiguredException(__('Column renders are not specified for your datatable.'));\n }\n }", "public function validate()\n {\n if (!$this->migrationsDatabaseName) {\n $message = 'Migrations Database Name must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n if (!$this->migrationsNamespace) {\n $message = 'Migrations namespace must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n if (!$this->migrationsDirectory) {\n $message = 'Migrations directory must be configured in order to use AntiMattr migrations.';\n throw new ConfigurationValidationException($message);\n }\n }", "private function configurationChecks()\n {\n\n // Debug Check: If debug enabled, check that debug email is set\n if ($this->salesforceDebug && is_string($this->salesforceDebugEmail) && $this->salesforceDebugEmail != '') {\n throw new \\InvalidArgumentException('With debug mode enabled, you must set the debug email address.');\n }\n\n\n // OID Check: Make sure the unique Salesforce account identifier is set and is a string\n if (!$this->defaultFields['oid'] && is_string($this->defaultFields['oid']) && $this->defaultFields['oid'] != '') {\n throw new \\InvalidArgumentException('The unique Salesforce account ID (oid) must be set as a string.');\n }\n\n return true;\n }", "public function validateSchema(): void\n {\n $schemaStructure = [\n 'connections' => [\n 'from' => [\n 'host', 'username', 'password'\n ],\n 'to' => [\n 'host', 'username', 'password'\n ]\n ]\n ];\n $this->handleSchemaRequirmentsChecks($schemaStructure);\n }", "private function validateLicenseData()\n {\n\n // error_log('LicenseEmail : '.print_r($this->getLicenseEmail(), 1));\n // error_log('LicenseProduct : '.print_r($this->getLicenseProduct(), 1));\n // error_log('LicenseSecretKey : '.print_r($this->getLicenseSecretKey(), 1));\n }", "public function validate()\n\t{\n\t\t// Get the event data\n\t\t$option_data = & Swiftriver_Event::$data;\n\t\t\n\t\tif ( ! (isset($option_data['channel']) AND $option_data['channel'] == 'twitter'))\n\t\t\treturn;\n\t\t\n\t\t$parameters = $option_data['parameters'];\n\t\tKohana::$log->add(Log::DEBUG, var_export($parameters, TRUE));\n\n\t\tif ( ! isset($parameters['value']['user']) &&\n\t\t\t ! isset($parameters['value']['keyword']) &&\n\t\t\t\t ! isset($parameters['value']['location']))\n\t\t\tthrow new Swiftriver_Exception_Channel_Option('Invalid Twitter Parameters');\n\t}", "protected function configureValidations()\n {\n }", "public function validate() {\n\t\t$errors = [];\n\t\t\n\t\t$requiredFiles = [\n\t\t\t\"{$this->dmDir}/config.json\",\n\t\t\t\"{$this->dmDir}/email-transport.json.template\",\n\t\t\t\"{$this->dmDir}/create-database.sql.template\",\n\t\t\t\"{$this->dmDir}/dbc.json.template\",\n\t\t];\n\t\t$missingFiles = [];\n\t\tforeach( $requiredFiles as $f ) {\n\t\t\tif( !file_exists($f) ) $missingFiles[] = $f;\n\t\t}\n\t\tif( $missingFiles ) {\n\t\t\t$errors[] = \"The following required files are missing:\\n- \".implode(\"\\n- \", $missingFiles);\n\t\t}\n\t\t\n\t\t$requiredConfigVars = [\n\t\t\t\"hostname-postfix\",\n\t\t\t\"deployment-root\",\n\t\t\t\"users\",\n\t\t\t\"users/postgres/username\",\n\t\t\t\"users/deployment-owner/username\",\n\t\t\t\"users/apache-manager/username\",\n\t\t\t\"sendgrid-password\",\n\t\t\t\"email-recipient-override\",\n\t\t];\n\t\t$missingConfigVars = [];\n\t\tforeach( $requiredConfigVars as $var ) {\n\t\t\tif( $this->getConfig($var,'__UNS') === '__UNS' ) {\n\t\t\t\t$missingConfigVars[] = $var;\n\t\t\t}\n\t\t}\n\t\tif( $missingConfigVars ) {\n\t\t\t$errors[] = \"The following required config entries are missing:\\n- \".implode(\"\\n- \",$missingConfigVars);\n\t\t}\n\t\t\n\t\tif( $errors ) {\n\t\t\tthrow new EarthIT_PhrebarDeploymentManager_EnvironmentException(implode(\"\\n\\n\", $errors));\n\t\t}\n\t}", "protected function validateSettings()\n {\n if (empty($this->authKey) || empty($this->senderId)) {\n throw new SMSFailException('Missing required configuration for sending SMS with MSG91.');\n }\n }", "protected function validateConfigObject(): void\n {\n $fields = ['host', 'port', 'user', 'database', 'password', 'persistent'];\n\n foreach ($fields as $field) {\n if (!isset($this->jsonObject->$field)) {\n throw new DbConnectorException(\n 'DbConnector requires ' . $field . ' to be set in the config file.',\n 1004\n );\n }\n }\n }", "function checkPublish(){\n\t\trequire('variables.php');\t\t\n\t\t// check the number of results\n\t\t$numResults = $this->getResults(\"count\");\n\t\t// check the number of questions\n\t\t$numQuestions = $this->getQuestions(\"count\");\n\t\t// check the number of options\n\t\t$listQuestion = explode(',', $this->getQuestions());\n\t\t\n\t\tif($numQuestions != 0){\n\t\t\t$questionState = true;\n\t\t\t$optionState = true;\n\t\t\tforeach($listQuestion as $question){\n\t\t\t\t// check the number of options for this question\n\t\t\t\t$numOptions = $this->getOptions($question, \"count\");\n\t\t\t\tif($numOptions < $VAR_QUIZ_MIN_OPTIONS){\n\t\t\t\t\t$optionState = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$questionState = false;\n\t\t\t$optionState = false;\n\t\t}\n\t\t// run through the checks, return false if failed\n\t\tif($numResults < $VAR_QUIZ_MIN_RESULT || $numQuestions < $VAR_QUIZ_MIN_QUESTIONS || !$optionState){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "public function validateConfig(array $config)\n {\n $nonEmpty = $this->getNonEmptyConfigKeys();\n foreach ($nonEmpty as $key) {\n if (empty($config[$key])) {\n throw new Exception(\"{$key} configuration value is required\");\n }\n }\n if ($config['postinst'] && 0 !== strpos($config['postinst'], '#!/')) {\n throw new Exception(\"{$config['shortName']}: shebang directive required\");\n }\n }", "public function validate_config_on_save($host_obj)\n\t\t{\n\t\t\t$hash_value = trim($host_obj->certificate);\n\t\t\t\n\t\t\tif (!strlen($hash_value))\n\t\t\t{\n\t\t\t\tif (!isset($host_obj->fetched_data['certificate']) || !strlen($host_obj->fetched_data['certificate']))\n\t\t\t\t\t$host_obj->validation->setError('Please paste certificate file content', 'certificate', true);\n\n\t\t\t\t$host_obj->certificate = $host_obj->fetched_data['certificate'];\n\t\t\t}\n\t\t}" ]
[ "0.65937406", "0.63652235", "0.6356139", "0.6249657", "0.59997827", "0.58409977", "0.58204776", "0.5801136", "0.5783785", "0.5775839", "0.5659375", "0.561419", "0.5550804", "0.55022484", "0.5473128", "0.5472512", "0.5472512", "0.5472171", "0.54703027", "0.5464649", "0.54235435", "0.5422496", "0.5422107", "0.5413093", "0.540253", "0.5393697", "0.5387546", "0.5378595", "0.5351974", "0.535107" ]
0.6506943
1
Normalizes a map child element.
protected function _normalizeChild($child, $config = null) { if (is_scalar($child) || is_null($child)) { return $this->_normalizeSimpleChild($child, $config); } return $this->_normalizeComplexChild($child, $config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _normalizeSimpleChild($child, $config);", "protected function normalize() {}", "private function normalize_distribution_info()\r\n {\r\n $distribution_info=$this->get_key_value('distribution_info');\r\n \r\n $output=array();\r\n $columns=array_keys($this->xpath_map['distribution_info']['items']);\r\n \r\n //there could be multiple distribution info tags\r\n //combine all into one array\r\n foreach($distribution_info as $row)\r\n {\r\n foreach($row as $key=>$value)\r\n {\r\n foreach($value as $val){\r\n $output[$key][]=$val;\r\n }\r\n }\r\n }\r\n \r\n $distribution_info=$output;\r\n $output=array();\r\n \r\n //create associated array\r\n foreach($distribution_info as $key=>$value)\r\n {\r\n $k=0;\r\n foreach($value as $val)\r\n {\r\n $output[$k][$key]=$val;\r\n $k++;\r\n }\r\n \r\n }\r\n \r\n $this->xpath_map['distribution_info']['data']=$output; \r\n }", "public function rebuildFromBase( EntityMap $map ): void {\n $current = clone $this;\n\n $this->key = $map->key;\n if ( $current->key !== null ) {\n $this->key = $current->key;\n }\n\n $this->inboundMap = array_merge( $map->inboundMap, $current->inboundMap );\n $this->outboundMap = $map->outboundMap;\n foreach ( $current->outboundMap as $propName => $mapping ) {\n if ( is_string( $mapping ) ) {\n $this->outboundMap[$propName] = $mapping;\n continue;\n }\n\n $baseMapping = array_key_exists( $propName, $map->outboundMap )? $map->outboundMap[$propName] : [];\n $this->outboundMap[$propName] = array_merge( $baseMapping, $mapping );\n }\n\n unset( $current );\n }", "protected function normalize(): void\n {\n $coordinate = new BaseCoordinate(array(0, $this->value));\n $latitude = (float)$coordinate->getLongitude();\n\n $this->value = $latitude;\n }", "private function _normalize($list) {\n // If an array wasn't submitted there's nothing to do...\n if (!is_array($list)) {\n return $list;\n }\n $ret = array();\n\n foreach ($list as $key => $val) {\n $val['location'] = isset($val['location']) ? $val['location'] : $key;\n $val['label'] = isset($val['label']) ? $val['label'] : $key;\n $val['class'] = isset($val['class']) ? ' '.$val['class'] : '';\n $val['id'] = isset($val['id']) ? \" id='{$val['id']}'\" : '';\n \n if (isset($val['parent_id'])) {\n if ( isset($ret[$val['parent_id']])) { \n // if parent doesn't exist, the children wont either\n $ret[$val['parent_id']]['children'][$key] = $val;\n }\n } else {\n $ret[$key] = $val;\n }\n }\n return $ret;\n }", "public function normalize()\n {\n }", "protected static function normalize(DOMDocument $ir)\n\t{\n\t\tself::addDefaultCase($ir);\n\t\tself::addElementIds($ir);\n\t\tself::addCloseTagElements($ir);\n\t\tself::markEmptyElements($ir);\n\t\tself::optimize($ir);\n\t\tself::markConditionalCloseTagElements($ir);\n\t\tself::setOutputContext($ir);\n\t\tself::markBranchTables($ir);\n\t}", "function prepare_map ($map) {\r\n\t\tif (!$map) return false;\r\n\t\t$markers = unserialize(@$map['markers']);\r\n\t\t$options = unserialize(@$map['options']);\r\n\t\t$post_ids = unserialize(@$map['post_ids']);\r\n\t\t$defaults = get_option('agm_google_maps');\r\n\r\n\t\t// Data is force-escaped by WP, so compensate for that\r\n\t\t$result = array_map('stripslashes_deep', array(\r\n\t\t\t\"markers\" => $markers,\r\n\t\t\t\"defaults\" => $defaults,\r\n\t\t\t\"post_ids\" => array_values($post_ids), // Reindex the array, so it doesn't turn up as JSON object\r\n\t\t\t\"id\" => @$map['id'],\r\n\t\t\t\"title\" => @$map['title'],\r\n\t\t\t\"height\" => @$options['height'],\r\n\t\t\t\"width\" => @$options['width'],\r\n\t\t\t\"zoom\" => @$options['zoom'],\r\n\t\t\t\"map_type\" => @$options['map_type'],\r\n\t\t\t\"map_alignment\" => @$options['map_alignment'],\r\n\t\t\t\"show_map\" => @$options['show_map'],\r\n\t\t\t\"show_posts\" => @$options['show_posts'],\r\n\t\t\t\"show_markers\" => @$options['show_markers'],\r\n\t\t\t\"show_images\" => @$options['show_images'],\r\n\t\t\t\"image_size\" => @$options['image_size'],\r\n\t\t\t\"image_limit\" => $options['image_limit'],\r\n\t\t\t\"show_panoramio_overlay\" => @$options['show_panoramio_overlay'],\r\n\t\t\t\"panoramio_overlay_tag\" => @$options['panoramio_overlay_tag'],\r\n\t\t\t\"street_view\" => @$options['street_view'],\r\n\t\t\t\"street_view_pos\" => @$options['street_view_pos'],\r\n\t\t\t\"street_view_pov\" => @$options['street_view_pov'],\r\n\t\t));\r\n\r\n\t\tif (isset($map['blog_id'])) $result['blog_id'] = $map['blog_id'];\r\n\r\n\t\treturn $result;\r\n\t}", "protected function mapChild($dest=[]){\n\n\t\tswitch(gettype($dest)){\n\n\t\t\tcase \"array\":\n\n\t\t\t\tif (count($dest)==0) $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.implode('\"][\"',$dest).'\"];');\t\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"string\":\n\n\t\t\t\tif ($dest==\"\") $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.str_replace('_','\"][\"',$dest).'\"];');\t\n\n\t\t\t\tbreak;\n\n\t\t\tdefault :\n\n\t\t\t\tif ($dest==$this::$root) $mymap = $this::$map;else \n\n\t\t\t\t\teval('$mymap = $this::$map[\"'.implode('\"][\"',$dest->address).'\"];');\n\n\t\t}\t\n\n\t\treturn array_keys($mymap);\n\n\t}", "public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )\n {\n if ( !isset( $this->mapping[$node->tagName] ) )\n {\n $converter->triggerError( E_WARNING,\n \"Mapping handler used for element '{$node->tagName}', not known by the mapping handler.\"\n );\n return $root;\n }\n\n $element = $root->ownerDocument->createElement( $this->mapping[$node->tagName] );\n $root->appendChild( $element );\n\n // Recurse\n $converter->visitChildren( $node, $element );\n return $root;\n }", "public function normalize(): self;", "public function exportNormalizationMap()\r\n\t{\r\n\t\t$query = 'SELECT keyword, ingredientID\r\n\t\t\tFROM normalizationMap';\r\n\t\t$this->_db->setQuery($query);\r\n\t\t$normalizationMap = $this->_db->loadAssocList();\r\n\t\treturn $normalizationMap;\r\n\t}", "protected function _normalizeComplexChild($child, $config = null)\n {\n return $this->_createChildInstance($child, $config);\n }", "public function transform(Row $row)\n {\n foreach($this->columns as $key => $value) {\n $districtName = $row->get($value);\n $row->remove($value);\n $row->set('district', trim($this->districts[$districtName]));\n }\n }", "public function processCmdmap_postProcess($command, $table, $id, $value, &$parentObject) {\n\t\tif (!(($table == 'pages') || ($table == 'tt_content'))) {\n\t\t\t// Guard clause\n\t\t\treturn;\n\t\t}\n\t\t$this->parentObject = &$parentObject;\n\t\tswitch ($command) {\n\n\t\t\tcase 'move':\n\t\t\t\t// Moving tt_content elements is handled in \"moveRecord_firstElementPostProcess\"\n\t\t\t\t// and \"moveRecord_afterAnotherElementPostProcess\"\n\t\t\tbreak;\n\n\t\t\tcase 'copy':\n\t\t\t\tif ($table == 'pages') {\n\t\t\t\t\t// A page has been copied.\n\t\t\t\t\t// Just take care all elements contained in kb_nescefe elements get set properly.\n\t\t\t\t\t// The UIDs of all copied element can be found in the copyMappingArray class variable\n\t\t\t\t\t$this->remapNescefeContents();\n\t\t\t\t} else {\n\t\t\t\t\t// Single elements get copied.\n\t\t\t\t\t// Take care that elements contained inside kb_nescefe elements get copied as well.\n\t\t\t\t\t$this->remapNescefeContents(TRUE);\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 'localize':\n\t\t\t\tif ($table == 'tt_content') {\n\t\t\t\t\t$this->remapNescefeContents(TRUE, intval($value));\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 'delete':\n\t\t\t\t// Implemented in \"processCmdmap_preProcess\"\n\t\t\tbreak;\n\n\t\t\tcase 'undelete':\n\t\t\t\t// \"undelete\" is performed in the postProcess routine. So first the container will get restored\n\t\t\t\t// and afterwards all the elements inside the container\n\t\t\t\tif ($table === 'tt_content') {\n\t\t\t\t\t$this->processDelete($id, 'undelete');\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\t\t// Not implemented currently\n\t\t\tcase 'inlineLocalizeSynchronize':\n\t\t\tcase 'version':\n\t\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}", "protected function normalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->transform($value);\n }", "private function _checkMap()\n {\n foreach($this->_map as $alias => $field)\n {\n if(!is_array($field))\n {\n $this->_map[$alias] = array(\n self::MAP_FIELD => $field\n );\n }\n if(isset($field[self::MAP_TYPE]) && in_array($field[self::MAP_TYPE],\n self::$_relationTypes))\n {\n switch($field[self::MAP_TYPE])\n {\n case self::RELATION_PARENT:\n if(empty($field[self::MAP_KEY]) || empty($field[self::MAP_FOREIGN_KEY]))\n {\n $mapper = $field[self::MAP_MAPPER];\n $mapper = new $mapper();\n }\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $mapper->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $alias . ucfirst($mapper->getKeyField());\n }\n break;\n\n case self::RELATION_CHILD:\n case self::RELATION_CHILDREN:\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $this->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n /** @var Core_Entity_Mapper_Abstract */\n $mapper = $field[self::MAP_MAPPER];\n $mapper = new $mapper();\n $backRelation = $mapper->_findRelationToMapperSettings(get_class($this),\n self::RELATION_PARENT);\n if($backRelation != null && !empty($backRelation[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $backRelation[self::MAP_FOREIGN_KEY];\n }\n else\n {\n $field[self::MAP_FOREIGN_KEY] = $this->_getPureModelNameField() . ucfirst($this->getKeyField());\n }\n }\n if(!isset($field[self::MAP_SAVE]))\n {\n $field[self::MAP_SAVE] = true;\n }\n if(!isset($field[self::MAP_DELETE]))\n {\n $field[self::MAP_DELETE] = true;\n }\n break;\n\n case self::RELATION_M2M:\n /** @var Core_Entity_Mapper_Abstract */\n $targetMapper = $field[self::MAP_MAPPER];\n $targetMapper = new $targetMapper();\n\n /** @var Core_Entity_Mapper_Abstract */\n $middleMapper = $field[self::MAP_MIDDLE_MAPPER];\n $middleMapper = new $middleMapper();\n if(empty($field[self::MAP_KEY]))\n {\n $field[self::MAP_KEY] = $this->getKeyField();\n }\n if(empty($field[self::MAP_FOREIGN_KEY]))\n {\n $backRelation = $middleMapper->_findRelationToMapperSettings(get_class($this),\n self::RELATION_PARENT);\n if($backRelation == null)\n {\n throw new Core_Entity_Exception('Middle Mapper Not configured for m2m relation \"' . get_class($this) . '->' . get_class($middleMapper) . '\"');\n }\n if($backRelation != null && !empty($backRelation[self::MAP_FOREIGN_KEY]))\n {\n $field[self::MAP_FOREIGN_KEY] = $backRelation[self::MAP_FOREIGN_KEY];\n }\n else\n {\n $field[self::MAP_FOREIGN_KEY] = $this->_getPureModelNameField() . ucfirst($this->getKeyField());\n }\n }\n $field[self::MAP_SAVE] = false;\n $field[self::MAP_DELETE] = false;\n break;\n\n default:\n $log = Core_Log_Manager::getInstance()->getLog('default');\n if(!empty($log))\n {\n $log->log(\"[\" . get_class($this) . \"]\\t\" . 'Unknown relation type \"' . $field[self::MAP_TYPE] . '\"',\n Zend_Log::NOTICE);\n }\n throw new Core_Entity_Exception('Unknown relation type \"' . $field[self::MAP_TYPE] . '\"');\n break;\n }\n $this->_map[$alias] = $field;\n }\n }\n }", "function getSimplifiedElements() {\n\t\t\t$newelements = array();\n\t\t\tforeach($this->page_object as $current_row) {\n\t\t\t\t## process the rows- first we need to find out how many entries\n\t\t\t\tforeach($current_row as $current_element) {\n\t\t\t\t\t## here we start calling all our attribute types\n\t\t\t\t\tif(is_array($current_element)) {\n\t\t\t\t\t\t$newelements[] = $current_element;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\t\t\t\n\t\t\treturn $newelements;\n }", "public function unFlattenNode(&$node, $name) {\n\t\t$domElement = $this->getChildNode($node, $name);\n\t\tif (!is_null($domElement) && $this->extractNodeText($domElement) !== '') {\n\t\t\t$tempDoc = new \\DOMDocument();\n\t\t\t$tempDoc->loadXML('<temp>'.$this->extractNodeText($domElement).'</temp>');\n\t\t\t\n\t\t\tif ($tempDoc->childNodes->length !== 1 || !($tempDoc->childNodes->item(0) instanceof \\DOMElement)) {\n\t\t\t\tthrow new ComhonException('wrong xml, XMLInterfacer manage xml with one and only one root node');\n\t\t\t}\n\t\t\t$toRemove = [];\n\t\t\tforeach ($domElement->childNodes as $child) {\n\t\t\t\t$toRemove[] = $child;\n\t\t\t}\n\t\t\tforeach ($toRemove as $child) {\n\t\t\t\t$domElement->removeChild($child);\n\t\t\t}\n\t\t\tforeach ($tempDoc->childNodes->item(0)->childNodes as $child) {\n\t\t\t\t$childNode = $this->domDocument->importNode($child, true);\n\t\t\t\t$domElement->appendChild($childNode);\n\t\t\t}\n\t\t}\n\t}", "public function normalize($node) {\n\t\tif (is_array($node)) {\n\t\t\t$node = array_values($node);\n\t\t\t$primary = 'id';\n\n\t\t\tif (!is_object($node[0])) {\n\t\t\t\t$node[0] = ClassRegistry::init($node[0]);\n\t\t\t}\n\n\t\t\t$node[0]->id = $node[1];\n\t\t\treturn $node[0];\n\t\t}\n\n\t\treturn $node;\n\t}", "public function updateMap(){\n $out = '';\n\n preg_match( '/<phpDBMapper:map>(.*)<\\/phpDBMapper:map>/s', $this->template, $m );\n\n foreach( $this->tableMapper as $c ){\n $tmp = $m[1];\n\n foreach( $c as $key=>$val ){\n $tmp = str_replace( '%'. $key .'%', $val, $tmp );\n $tmp = str_replace(array(\"\\n\", \"\\r\"), '', $tmp);\n }\n\n $out .= $tmp . \"\\n\";\n }\n\n $this->template = preg_replace( '/<phpDBMapper:map[^>]*?>.*?<\\/phpDBMapper:map>/is', $out, $this->template );\n return $this->template;\n }", "protected abstract function map();", "function automap_tree_to_map_config($MAPCFG, &$params, &$saved_config, &$map_config, &$tree) {\n if(isset($map_config[$tree['object_id']])) {\n return;\n }\n\n $map_config[$tree['object_id']] = $tree;\n \n // Remove internal attributes here\n unset($map_config[$tree['object_id']]['.childs']);\n unset($map_config[$tree['object_id']]['.parents']);\n\n foreach($tree['.childs'] AS $child) {\n automap_tree_to_map_config($MAPCFG, $params, $saved_config, $map_config, $child);\n $line = automap_connector($MAPCFG, $params, $saved_config, $tree, $child);\n $map_config[$line['object_id']] = $line;\n }\n\n foreach($tree['.parents'] AS $parent) {\n automap_tree_to_map_config($MAPCFG, $params, $saved_config, $map_config, $parent);\n $line = automap_connector($MAPCFG, $params, $saved_config, $tree, $parent);\n $map_config[$line['object_id']] = $line;\n }\n}", "public function transform(TreeCollection $collection)\n {\n return array_map([$this, 'transformEntry'], $collection->getEntries());\n }", "public function processCmdmap_afterFinish(\\TYPO3\\CMS\\Core\\DataHandling\\DataHandler $parentObject) {\n\t\tif (is_array($parentObject->moveInfo) && count($parentObject->moveInfo)) {\n\t\t\tforeach ($parentObject->moveInfo as $id => $param) {\n\t\t\t\t$this->sanitizeRecordValues($id);\n\t\t\t\tif ($param === 'container') {\n\t\t\t\t\t// When moving a container take care all elements inside get also moved\n\t\t\t\t\t$this->moveContainedElements($id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (is_array($this->parentObject->copyMappingArray['tt_content'])) {\n\t\t\tforeach ($this->parentObject->copyMappingArray['tt_content'] as $origUid => $newUid) {\n\t\t\t\t$this->sanitizeRecordValues($newUid);\n\t\t\t}\n\t\t}\n\t}", "function get_all_posts_maps () {\r\n\t\t$table = $this->get_table_name();\r\n\t\t$maps = $this->wpdb->get_results(\"SELECT * FROM {$table} WHERE post_ids <> 'a:0:{}'\", ARRAY_A);\r\n\t\tif (is_array($maps)) foreach ($maps as $k=>$v) {\r\n\t\t\t$maps[$k] = $this->prepare_map($v);\r\n\t\t}\r\n\t\treturn $maps;\r\n\t}", "public function elements_sanitize( $input )\n {\n $new_input = array();\n foreach ($this->elements as $id => $title) {\n if( isset( $input[$id] ) ){\n $new_input[$id] = sanitize_text_field( $input[$id] );\n }else{\n $new_input[$id] = '';\n }\n\n if( !isset( $input[$id . '_important'] ) )\n $new_input[$id . '_important'] = 0 ;\n else\n $new_input[$id . '_important'] = intval($input[$id . '_important']);\n\n if( isset( $input[$id . '_weight'] ) )\n $new_input[$id . '_weight'] = sanitize_text_field($input[$id . '_weight']);\n\n }\n\n return $new_input;\n }", "function _postProcess() {\r\n $item = current($this->_struct);\r\n \r\n $ret = array('_name'=>$item['tag'], '_attributes'=>array(), '_value'=>null);\r\n\r\n if (isset($item['attributes']) && count($item['attributes'])>0) {\r\n foreach ($item['attributes'] as $key => $data) {\r\n if (!is_null($data)) {\r\n $item['attributes'][$key] = str_replace($this->_replaceWith, $this->_replace, $item['attributes'][$key]);\r\n }\r\n }\r\n $ret['_attributes'] = $item['attributes'];\r\n if ($this->attributesDirectlyUnderParent)\r\n $ret = array_merge($ret, $item['attributes']);\r\n }\r\n\r\n if (isset($item['value']) && $item['value'] != null)\r\n $item['value'] = str_replace($this->_replaceWith, $this->_replace, $item['value']);\r\n \r\n switch ($item['type']) {\r\n case 'open':\r\n $children = array();\r\n while (($child = next($this->_struct)) !== FALSE ) {\r\n if ($child['level'] <= $item['level'])\r\n break;\r\n \r\n $subItem = $this->_postProcess();\r\n \r\n if (isset($subItem['_name'])) {\r\n if (!isset($children[$subItem['_name']]))\r\n $children[$subItem['_name']] = array();\r\n \r\n $children[$subItem['_name']][] = $subItem;\r\n }\r\n else {\r\n foreach ($subItem as $key=>$value) {\r\n if (isset($children[$key])) {\r\n if (is_array($children[$key]))\r\n $children[$key][] = $value;\r\n else\r\n $children[$key] = array($children[$key], $value);\r\n }\r\n else {\r\n $children[$key] = $value;\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ($this->childTagsDirectlyUnderParent)\r\n $ret = array_merge($ret, $this->_condenseArray($children));\r\n else\r\n $ret['_value'] = $this->_condenseArray($children);\r\n \r\n break;\r\n case 'close':\r\n break;\r\n case 'complete':\r\n if (count($ret['_attributes']) > 0) {\r\n if (isset($item['value']))\r\n $ret['_value'] = $item['value'];\r\n }\r\n else {\r\n\t\t\tif (isset($item['value'])) {\r\n\t\t\t\t$ret = array($item['tag']=> $item['value']);\r\n\t\t\t} else {\r\n\t\t\t\t$ret = array($item['tag']=> \"\");\r\n\t\t\t}\r\n }\r\n break;\r\n }\r\n\r\n //added by Dan Coulter\r\n\r\n \r\n /*\r\n foreach ($ret as $key => $data) {\r\n if (!is_null($data) && !is_array($data)) {\r\n $ret[$key] = str_replace($this->_replaceWith, $this->_replace, $ret[$key]);\r\n }\r\n }\r\n */\r\n return $ret;\r\n }", "protected function mapEmbedded(&$root)\n {\n if (is_array($root) && isset($root['_embedded']) && is_array($root['_embedded']))\n {\n foreach ($root['_embedded'] as $property => $data)\n {\n $root[$property] = $data;\n }\n $this->mapEmbedded($root['_embedded']);\n }\n\n return $root;\n }" ]
[ "0.5970735", "0.507048", "0.49233034", "0.48846003", "0.47905284", "0.4761365", "0.47502396", "0.47165027", "0.4715329", "0.4624372", "0.45812443", "0.4578584", "0.45542377", "0.45134294", "0.45044053", "0.44534683", "0.44210777", "0.440279", "0.43981013", "0.43913502", "0.4379593", "0.4376122", "0.4363332", "0.43299085", "0.4315588", "0.430256", "0.4283488", "0.4271971", "0.42314607", "0.42287138" ]
0.54417175
1
Normalizes a scalar child.
abstract protected function _normalizeSimpleChild($child, $config);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _normalizeChild($child, $config = null)\n {\n if (is_scalar($child) || is_null($child)) {\n return $this->_normalizeSimpleChild($child, $config);\n }\n\n return $this->_normalizeComplexChild($child, $config);\n }", "public function normalize(): self;", "public function normalize() {\n return $this->div($this->norm());\n }", "protected function normalize() {}", "public function normalize()\n {\n }", "protected function normalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->transform($value);\n }", "protected function normalize()\r\n\t{\r\n\t\tif ($this->isFetched())\r\n\t\t{\r\n\t\t\tif ($this->validationInfo)\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->validationInfo->normalize($this->taintValue);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->normalizedValue = $this->taintValue;\r\n\t\t\t}\t\r\n\t\t}\r\n\t}", "public function normalize($value)\n {\n if ($value instanceof Expression ||\n $value instanceof Expressionable) {\n return $value;\n }\n\n return parent::normalize($value);\n }", "protected function _normalizeComplexChild($child, $config = null)\n {\n return $this->_createChildInstance($child, $config);\n }", "protected function denormalize($value)\n {\n if (null === $this->normalizationTransformer) {\n return $value;\n }\n return $this->normalizationTransformer->reverseTransform($value, $this->data);\n }", "function normalize()\n\t\t{\n\t\t\t$m = $this->magnitude();\n\t\t\t$res = new Vector(array('dest' => new Vertex(array(\n\t\t\t\t'x' => $this->_x / $m,\n\t\t\t\t'y' => $this->_y / $m,\n\t\t\t\t'z' => $this->_z / $m\n\t\t\t))));\n\t\t\treturn ($res);\n\t\t}", "protected function processNormalization(NormalizeValueContext $context): void\n {\n $value = $context->getResult();\n if (null !== $value && $this->isValueNormalizationRequired($value)) {\n if ($context->isRangeAllowed() && str_contains($value, $context->getRangeDelimiter())) {\n $context->setResult($this->normalizeRangeValue($value, $context->getRangeDelimiter()));\n } elseif ($context->isArrayAllowed()) {\n $context->setResult($this->normalizeArrayValue($value, $context->getArrayDelimiter()));\n } else {\n $this->validateValue($value);\n $context->setResult($this->normalizeValue($value));\n }\n }\n $context->setProcessed(true);\n }", "public function getQuantityPerUnitNormalizedAttribute()\n {\n return normalizeQuantity($this->quantity_per_unit, $this->dividendAssetModel->divisible);\n }", "protected function normalize(): void\n {\n $coordinate = new BaseCoordinate(array(0, $this->value));\n $latitude = (float)$coordinate->getLongitude();\n\n $this->value = $latitude;\n }", "public function scale() { }", "private function normToView(mixed $value): mixed\n {\n // Scalar values should be converted to strings to\n // facilitate differentiation between empty (\"\") and zero (0).\n // Only do this for simple forms, as the resulting value in\n // compound forms is passed to the data mapper and thus should\n // not be converted to a string before.\n if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) {\n return null === $value || \\is_scalar($value) ? (string) $value : $value;\n }\n\n try {\n foreach ($transformers as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform value for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "public function getNormalization()\r\n {\r\n return $this->normalization;\r\n }", "protected function normalize_attribute($name, $value)\n {\n }", "private function scaleX() : void\n\t{\n\t\t$this->domain = abs($this->rangeXLow) + abs($this->rangeXHigh);\n\n\t\t$this->scaleX = ((float)$this->sizeX / $this->domain);\n\t\t$this->originX = $this->sizeX >> 1;\n\t\t\n\t}", "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 }", "public function getNormalizedData()\n {\n return parent::getNormalizedData();\n }", "public function getColumnDenormalizedValue($value)\n {\n return $this->getDriver()->getColumnDenormalizedValue($this, $value);\n }", "public function normalize($name);", "public function normalize(): string\n {\n return $this->getValue();\n }", "public function normalize(ContentEntityInterface $entity);", "public function scale(float $scale_x = 0, float $scale_y = 0, float $scale_z = 0): EntityInterface;", "private function modelToNorm(mixed $value): mixed\n {\n try {\n foreach ($this->config->getModelTransformers() as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedException $exception) {\n throw new TransformationFailedException(sprintf('Unable to transform data for property path \"%s\": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters());\n }\n\n return $value;\n }", "protected function onParentSet() : void\n {\n $value = $this->oFG->getData()->getValue($this->strName);\n $this->iValue = $value ? intval($value) : $this->iMin;\n }", "protected static function normalize(DOMDocument $ir)\n\t{\n\t\tself::addDefaultCase($ir);\n\t\tself::addElementIds($ir);\n\t\tself::addCloseTagElements($ir);\n\t\tself::markEmptyElements($ir);\n\t\tself::optimize($ir);\n\t\tself::markConditionalCloseTagElements($ir);\n\t\tself::setOutputContext($ir);\n\t\tself::markBranchTables($ir);\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}" ]
[ "0.6471258", "0.6371987", "0.60452414", "0.59849185", "0.5896082", "0.5582347", "0.55799043", "0.52229285", "0.51611996", "0.5126119", "0.512014", "0.49222156", "0.4889396", "0.487006", "0.48556662", "0.48279515", "0.4808294", "0.47634086", "0.47583905", "0.47532898", "0.47183013", "0.46980345", "0.46910453", "0.46797538", "0.46583056", "0.45221263", "0.4456345", "0.44055626", "0.44045153", "0.44031778" ]
0.6433867
1
Retrieves configuration that can be used to make a child instance with a factory.
abstract protected function _getChildConfig($child, $config);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _getChildFactory($child, $config);", "public function makeConfig() : Config\n {\n if($this->makeConfig) {\n return $this->makeConfig;\n }\n return $this->makeConfig = factory(Config::class)->make();\n }", "protected function getConfiguration() {}", "public function getConfiguration();", "public function getConfiguration();", "public function getConfiguration();", "abstract public function getConfig();", "public function getConfiguration() {}", "public function getConfiguration() {}", "public function getConfigurarion()\n {\n return $this->configuration;\n }", "abstract protected function getConfig();", "public static function getConfiguration();", "public function getConfiguration()\n {\n return $this->_config;\n }", "public function get() {\n return new ConfigurationObject($this->config);\n }", "protected static function configFactory() {\n return \\Drupal::configFactory();\n }", "public static function getConfig()\n {\n return new Config(self::$config);\n }", "abstract public static function createConfig(): Config;", "public function getConfiguration()\n {\n $configuration = parent::getConfiguration();\n $configuration['debug'] = isset($configuration['debug']) ? $configuration['debug'] : false;\n $configuration['fileUri'] = $this->container->getParameter(\"mapbender.uploads_dir\") . \"/data-store\";\n\n if (isset($configuration[\"schemes\"]) && is_array($configuration[\"schemes\"])) {\n foreach ($configuration[\"schemes\"] as $key => &$scheme) {\n if (is_string($scheme['dataStore'])) {\n $storeId = $scheme['dataStore'];\n $dataStore = $this->container->getParameter('dataStores');\n $scheme['dataStore'] = $dataStore[ $storeId ];\n $scheme['dataStore'][\"id\"] = $storeId;\n //$dataStore = new DataStore($this->container, $configuration['source']);\n }\n if (isset($scheme['formItems'])) {\n $scheme['formItems'] = $this->prepareItems($scheme['formItems']);\n }\n }\n }\n return $configuration;\n }", "public function getDependencyConfig()\n {\n return [\n 'factories' => [\n ],\n ];\n }", "public function getConfiguration()\n\t{\n\t\treturn $this->configuration;\n\t}", "public function getConfig(): Configuration;", "public function getConfiguration() {\n return $this->configuration;\n }", "public function getConfiguration()\n {\n return $this->configuration;\n }", "public function getConfig()\n {\n return $this->get('config');\n }", "public function getConfig()\n {\n $provider = new ConfigProvider();\n return [\n 'service_manager' => $provider->getDependencyConfig(),\n ];\n }", "public function getConfig()\n {\n $provider = new ConfigProvider();\n return [\n 'service_manager' => $provider->getDependencyConfig(),\n ];\n }", "public function getConfig()\n {\n return $this['config'];\n }", "public function get() {\n return $this->_configuration;\n }", "protected function _get_configuration(){\n\n return new Payment_Configuration();\n\n }", "protected function create_worker_config() {\n return $this->config;\n }" ]
[ "0.6683842", "0.6337842", "0.63298315", "0.6319361", "0.6319361", "0.6319361", "0.62551767", "0.623221", "0.62321466", "0.62004864", "0.61985964", "0.61840636", "0.617275", "0.61574715", "0.6112023", "0.61086655", "0.6069647", "0.6059253", "0.60442185", "0.60094297", "0.60064423", "0.6000968", "0.598136", "0.59808004", "0.5960582", "0.5960582", "0.5959842", "0.5957669", "0.5951482", "0.59461004" ]
0.6719752
0
Validate a suite class
final private function _isValidSuiteClass ($class) { $ref = new ReflectionClass($class); if ($class === $this->_baseClass or $ref->isSubclassOf($this->_baseClass)) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validateClasses()\n\t{\n\t\tforeach ($this->config->getConfigNode() as $libs) {\n\t\t\tforeach ($libs as $lib) {\n\t\t\t\tif (!$this->isClassValid($lib->class, IMetric::class)) {\n\t\t\t\t\t$this->addClassError($lib->class);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function assertValid($classname = NULL);", "public function check_validity($_classname);", "public function testIfClassCanBeCreated()\n {\n $this->assertInstanceOf(Validator::class, $this->_validator);\n }", "protected function checkForValidImplementingClass()\n {\n $this->validateModel();\n $this->validateItemId();\n }", "public function supportsSuite(Suite $suite);", "public function testValidate()\n {\n $this\n ->boolean(TestedClass::validatePattern('raoul'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('23'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('raoul.node.raoul'))\n ->isIdenticalTo(true)\n ->boolean(TestedClass::validatePattern('raoul.$\\\\'))\n ->isIdenticalTo(false)\n ->boolean(TestedClass::validatePattern('é'))\n ->isIdenticalTo(false)\n ->boolean(TestedClass::validatePattern('î'))\n ->isIdenticalTo(false)\n ;\n }", "public function testInstantiation()\n {\n $this->fixture = new ValidationReport(\n array( // results\n new ValidationResult(\n $this->nodeFactory->createNamedNode('http://focusNode/'),\n $this->nodeFactory->createNamedNode('http://resultPath/'),\n new Severity('sh:Warning'),\n $this->nodeFactory->createNamedNode('sh:MinMaxCountConstraintComponent'),\n $this->nodeFactory->createNamedNode('http://value')\n )\n )\n );\n\n $this->assertTrue($this->fixture->conforms());\n }", "static public function suite() {\n return Dev_Unit::load_with_prefix('Test.Templates.HTML.Forms.', 'Case');\n }", "public function testIsValid() {\n\n\n\n }", "public function testValidate() \n { \n $tester = new TarTareaProgramada();\n $tester->id_tarea_programada = \"Ingresar valor de pruebas para el campo id_tarea_programada de tipo int4\";\n $tester->nom_tarea_programada = \"Ingresar valor de pruebas para el campo nom_tarea_programada de tipo varchar\";\n $tester->fecha_inicio = \"Ingresar valor de pruebas para el campo fecha_inicio de tipo date\";\n $tester->fecha_termina = \"Ingresar valor de pruebas para el campo fecha_termina de tipo date\";\n $tester->fecha_proxima_eje = \"Ingresar valor de pruebas para el campo fecha_proxima_eje de tipo date\";\n $tester->intervalo_ejecucion = \"Ingresar valor de pruebas para el campo intervalo_ejecucion de tipo int4\";\n $tester->numero_ejecucion = \"Ingresar valor de pruebas para el campo numero_ejecucion de tipo int4\";\n \n expect_that($tester->validate());\n // en caso de incluir valores errados para el modelo: expect_not($model->validate());\n return $tester;\n }", "public function testInvalidClassParam() {\n\t\t$options = $this->_loadOptions;\n\t\t$options['class'] = 'Foo\\bar';\n\t\t$this->expectException('/Unsupported class given/');\n\t\t$posts = Fixture::load('models/Posts', $options);\n\t\t$this->_testLoad($posts);\n\t}", "public function testValidatorSetConstructor()\n\t{\n\t\t$validatorSet = new ValidatorSet();\n\n\t\t$this->assertNotNull($validatorSet);\n\t}", "public static function suite()\n {\n $suite = new PHPUnit_Framework_TestSuite('PHP CodeSniffer Standards');\n $baseDir = pathinfo(getcwd().\"/Ongr\", PATHINFO_DIRNAME);\n\n \\PHP_CodeSniffer::setConfigData('installed_paths', $baseDir);\n $path = pathinfo(\\PHP_CodeSniffer::getInstalledStandardPath('Ongr'), PATHINFO_DIRNAME);\n $testsDir = $path . DIRECTORY_SEPARATOR . 'Tests' . DIRECTORY_SEPARATOR . 'Unit';\n\n $directoryIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testsDir));\n\n /** @var \\SplFileInfo $fileinfo */\n foreach ($directoryIterator as $file) {\n // Skip hidden and extension must be php.\n if ($file->getFilename()[0] === '.' || pathinfo($file, PATHINFO_EXTENSION) !== 'php') {\n continue;\n }\n\n $className = str_replace(\n [$baseDir . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR],\n ['', '\\\\'],\n substr($file, 0, -4)\n );\n\n $suite->addTest(new $className('getErrorList'));\n }\n\n return $suite;\n }", "public function testClassCoversAllDemos()\n {\n $expected = count(glob(DEMO_DIR . '/*.php')) - 1;\n $actual = count(array_keys($this->expectedResults()));\n\n $this->assertEquals($expected, $actual, \"Not all demo's where covered in \" . __CLASS__);\n }", "abstract public function runValidation();", "public function check_installer($installer, $class_name)\n\t{\n\t}", "public function testIsValid()\n {\n $validator = new Idun_Validate_Nand(array(\n new Zend_Validate_StringLength(7, 32),\n new Zend_Validate_EmailAddress\n ));\n file_put_contents('/tmp/debug.log', var_export(get_class_methods($validator), true));\n file_put_contents('/tmp/debug.log', var_export(method_exists($validator, 'isValid'), true), FILE_APPEND);\n $ref = new ReflectionClass($validator);\n file_put_contents('/tmp/debug.log', var_export($ref->getMethods(), true), FILE_APPEND);\n file_put_contents('/tmp/debug.log', var_export($ref->hasMethod('isValid'), true), FILE_APPEND);\n $this->assertTrue($validator->isValid('dummy'));\n }", "public function testClass()\n {\n $uses = class_uses(HordeClient::class);\n $this->assertContains(FilterTrait::class, $uses);\n $this->assertContains(AttributeTrait::class, $uses);\n $this->assertContains(AttachmentTrait::class, $uses);\n\n $client = $this->createClient();\n $this->assertInstanceOf(MailClient::class, $client);\n }", "public function isValidationPassed();", "private function _checkClass()\n {\n if ($this->_useWithoutTypeCheck === true) {\n return true;\n }\n\n $resource = $this->_owApp->selectedResource;\n $rModel = $resource->getMemoryModel();\n\n // search with each expression using the preg matchtype\n foreach ($this->_types as $type) {\n if (isset($type['classUri'])) {\n $classUri = $type['classUri'];\n } else {\n continue;\n }\n if (\n $rModel->hasSPvalue(\n (string) $resource,\n EF_RDF_TYPE,\n $classUri\n )\n ) {\n return true;\n }\n }\n\n // type does not match to one of the expressions\n return false;\n }", "public static function validate() {}", "public function isValid()\r\n {\r\n if (!retGet('class'))\r\n return false;\r\n\r\n if (!in_array(retGet('class'), $this->_available))\r\n return false;\r\n\r\n return true;\r\n }", "public function testAll()\n {\n $this\n ->if($schema_validator = new SchemaValidator())\n ->and($object = new testedClass($schema_validator))\n ->and($config = array(\n '_metadata' => array(),\n '_partial' => 'nom_partial'\n ))\n ->then\n ->object($object)\n ->isInstanceOf('RomaricDrigon\\\\MetaYaml\\\\NodeValidator\\\\PartialNodeValidator')\n ->exception(function() use ($object, $config) { $object->validate('test', $config, array()); })\n ->hasMessage(\"You're using a partial but partial 'nom_partial' is not defined in your schema\")\n ;\n }", "abstract public function validate();", "abstract public function validate();", "public function testValidateDocumentExecutableValidation()\n {\n }", "public function testValidation()\n\t{\n\n\t\t// $this->assertInstanceOf('Model', $depot);\n\n\t\t// $this->specify('\\'depot_id and\\' \\'factory_type_id\\' is required', function() {\n\t\t// \t$factory->depot_id = null;\n\t\t// \t$factory->factory_type_id = null;\n // verify($factory->validate(['depot_id', 'factory_type_id'])->false());\n\t\t// });\n\n\t\t// $this->specify('factory', function() {\n\t\t// \t$factory->depot_id = $this->depot->depot_id;\n\t\t// \t$factory->factory_type_id = $this->factoryType->factory_type_id;\n\t\t// \tverify($factory->validate()->true());\n\t\t// });\n\t}", "public static function suite() {\n\t\t$Suite = new CakeTestSuite('All Tools tests');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib' . DS . 'Utility');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Lib' . DS . 'Misc');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'View');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'View' . DS . 'Helper');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model' . DS . 'Behavior');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Model' . DS . 'Datasource');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Console' . DS . 'Command');\n\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Controller' . DS . 'Component');\n\t\t$path = dirname(__FILE__);\n\t\t$Suite->addTestDirectory($path . DS . 'Controller' . DS . 'Component' . DS . 'Auth');\n\n\t\t//$path = dirname(__FILE__);\n\t\t//$Suite->addTestDirectory($path . DS . 'Controller');\n\n\t\t//$path = CakePlugin::path('Tools') . 'Test' . DS . 'Case' . DS;\n\t\t//$Suite->addTestDirectoryRecursive($path);\n\t\treturn $Suite;\n\t}", "public function testRun()\n {\n $scenario = new Hostingcheck_Scenario();\n $scenario->add(\n new Hostingcheck_Scenario_Group(\n 'group1',\n 'Group 1',\n new Hostingcheck_Scenario_Tests()\n )\n );\n $scenario->add(\n new Hostingcheck_Scenario_Group(\n 'group2',\n 'Group 2',\n new Hostingcheck_Scenario_Tests()\n )\n );\n\n $runner = new Hostingcheck_Runner($scenario);\n $results = $runner->run();\n $this->assertCount(2, $results);\n }" ]
[ "0.64271075", "0.64263386", "0.60432744", "0.60092914", "0.59393984", "0.58977675", "0.5857467", "0.58248943", "0.57671475", "0.56481177", "0.56185144", "0.55800825", "0.547926", "0.54645455", "0.54575545", "0.5451911", "0.54474896", "0.5442635", "0.5427876", "0.5391416", "0.53694916", "0.5316611", "0.5316225", "0.52820545", "0.5271751", "0.5271751", "0.5252784", "0.5234064", "0.52292717", "0.522665" ]
0.71460056
0
Return the TAN widget as object
protected function getTANWidget($value = null) { $widget = new TextField(); $widget->id = 'nrOfTAN'; $widget->name = 'nrOfTAN'; $widget->mandatory = true; $widget->maxlength = 5; $widget->rgxp = 'digit'; $widget->nospace = true; $widget->value = $value; $widget->required = true; $widget->label = $GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][0]; if ($GLOBALS['TL_CONFIG']['showHelp'] && strlen($GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][1])) { $widget->help = $GLOBALS['TL_LANG']['tl_survey_pin_tan']['nrOfTAN'][1]; } // Validate input if ($this->request->getPost('FORM_SUBMIT') == 'tl_export_survey_pin_tan') { $widget->validate(); if ($widget->hasErrors()) { $this->blnSave = false; } } return $widget; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getWidget();", "public function getWidget()\n\t{\n\t\treturn $this->widget;\n\t}", "public function WidgetClass(){\r\n\t\tYii::import(\"application.GWidgets.\".\".W\".$this->widget);\r\n\t\t$cname='W'.$this->widget;\r\n\t\t$widget=new $cname($this->GTemp,$this);\r\n\t\treturn $widget;\r\n\t}", "function getWidget() {\n // just override the template being used.\n $bHasErrors = false; \n \n require_once(KT_LIB_DIR . \"/documentmanagement/MDTree.inc\");\n \n $fieldTree = new MDTree();\n $fieldTree->buildForField($this->iFieldId);\n $fieldTree->setActiveItem($this->value);\n return $fieldTree->_evilTreeRenderer($fieldTree, $this->sName); \n }", "public static function ui() {\n return Yii::createObject(NotifyToolWidget::className()); //, [get_called_class()]\n }", "abstract public function getWidget() : string;", "public function getWidget(): \\WP_Widget{\n return $this->widget;\n }", "public function getWidget($name){\n\t\t\t$class = null;\n\t\t\tif(is_file($this->config['widgetFolder'].$name.'.widget.php')){\n\t\t\t\trequire_once($this->config['widgetFolder'].$name.'.widget.php');\n\t\t\t\t$name = 'UIW_'.$name;\n\t\t\t\t$class = new $name();\n\t\t\t} \n\t\t\treturn $class;\n\t\t}", "function box_widget(){\n\t$CI=& get_instance();\n\treturn $CI->parser->parse('layout/ddi/box_widget.html', $CI->data,true);\n}", "public static function a_widget_init() {\n\t\t\treturn register_widget(__CLASS__);\n\t\t}", "public function tv()\n {\n return new MiTv();\n }", "protected function getWidget()\n {\n $widgets = $this->getPage()->findAll('css', 'body div.filter-container ul.ui-multiselect-checkboxes');\n\n /** @var NodeElement $widget */\n foreach ($widgets as $widget) {\n if ($widget->isVisible()) {\n return $widget;\n }\n }\n\n self::fail('Could not find widget on page or it\\'s not visible');\n }", "public function render_widget() {\n\n return Widget::render($this->settings);\n\n }", "public function getDomObject()\n\t\t{\n\t\t\t$span = $this->createDomObject( 'span' );\n\t\t\t$span->setAttribute('id', $this->getHTMLControlId());\n\t\t\tif($this->errMsg) {\n\t\t\t\t$span->nodeValue = $this->errMsg;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$span->setAttribute('style', 'display:none;');\n\t\t\t}\n\t\t\treturn $span;\n\t\t}", "public function get_widget_data() {\n\n return Widget::get_widget_data($this->settings);\n\n }", "function getWidget() {\n // just override the template being used.\n $bHasErrors = false; \n if (count($this->aErrors) != 0) { $bHasErrors = true; }\n\n // at this last moment we pick the template to use \n $total = count($this->aVocab);\n if ($this->bUseSimple === true) {\n $this->sTemplate = 'ktcore/forms/widgets/simple_selection'; \n } else if ($this->bUseSimple === false) {\n $this->sTemplate = 'ktcore/forms/widgets/selection'; \n } else if (is_null($this->bUseSimple) && ($total <= $this->USE_SIMPLE)) {\n $this->sTemplate = 'ktcore/forms/widgets/simple_selection';\n } else {\n $this->sTemplate = 'ktcore/forms/widgets/selection';\n }\n \n $oTemplating =& KTTemplating::getSingleton(); \n $oTemplate = $oTemplating->loadTemplate($this->sTemplate);\n\n // have to do this here, and not in \"configure\" since it breaks \n // entity-select.\n $unselected = KTUtil::arrayGet($this->aOptions, 'unselected_label');\n if (!empty($unselected)) {\n // NBM: we get really, really nasty interactions if we try merge\n // NBM: items with numeric (but important) key values and other\n // NBM: numerically / null keyed items\n $vocab = array();\n $vocab[] = $unselected;\n foreach ($this->aVocab as $k => $v) {\n $vocab[$k] = $v;\n }\n \n $this->aVocab = $vocab;\n\n // make sure its the selected one if there's no value specified.\n if (empty($this->value)) {\n $this->value = 0;\n }\n }\n\n // performance optimisation for large selected sets.\n if ($this->bMulti) {\n $this->_valuesearch = array();\n $value = (array) $this->value;\n foreach ($value as $v) {\n $this->_valuesearch[$v] = true;\n }\n }\n \n $aTemplateData = array(\n \"context\" => $this,\n \"name\" => $this->sName,\n \"has_id\" => ($this->sId !== null),\n \"id\" => $this->sId,\n \"has_value\" => ($this->value !== null),\n \"value\" => $this->value,\n \"options\" => $this->aOptions,\n 'vocab' => $this->aVocab,\n );\n return $oTemplate->render($aTemplateData);\n }", "public function getRootWidget()\n {\n return $this->rootWidgetNode;\n }", "public static function widget() {\n\t\t$username = self::get_dashboard_widget_option(self::wid, 'username');\n\t\t$apikey = self::get_dashboard_widget_option(self::wid, 'apikey');\n\t\t$project_id = self::get_dashboard_widget_option(self::wid, 'project_id');\n\t\t$ref_url = 'http://go.endcore.64905.digistore24.com/';\n\t\t$check = ($username && $apikey && $project_id ? true : false);\n \n\t\tif(!$check) {\n\t\t\techo '<h4 style=\"text-align:right; padding-right: 40px; padding-top: 10px\">' . __( 'Bitte prüfe die Einstellungen &and;', 'affiliatetheme-backend' ) . '</h4>&nbsp;';\n ?>\n <div class=\"rankalyst-text\">\n <a href=\"<?php echo $ref_url; ?>\" target=\"_blank\"><img src=\"<?php echo get_template_directory_uri(); ?>/_/img/rankalyst.png\"></a>\n <p><?php printf(__('Mit <a href=\"%s\" target=\"_blank\">Rankalyst</a> kannst du 10 Keywords kostenlos tracken!', 'affiliatetheme-backend'), $ref_url); ?></p>\n <a href=\"<?php echo $ref_url; ?>\" target=\"_blank\" class=\"button button-primary\"><?php _e('Kostenlos starten', 'affiliatetheme-backend'); ?></a>\n </div>\n <?php\n\t\t}\n\t\t\n\t\t/* @TODO Rankingchange <span class=\"plus\">+</span> bzw Minus ausgeben, jenachdem ob Change positiv oder negativ. */\n\n ?>\n <div class=\"rankalyst-data\">\n <ul class=\"rankalyst-tabs\">\n <li><a href=\"#\" data-type=\"organic\" class=\"active\"><?php _e('Organic', 'affiliatetheme-backend'); ?></a></li>\n <li><a href=\"#\" data-type=\"mobile\"><?php _e('Mobile', 'affiliatetheme-backend'); ?></a></li>\n <li><a href=\"#\" data-type=\"local\"><?php _e('Local', 'affiliatetheme-backend'); ?></a></li>\n </ul>\n\n <div class=\"rankalyst-tab active\" data-type=\"organic\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 1);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n\n <div class=\"rankalyst-tab\" data-type=\"mobile\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 2);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n\n <div class=\"rankalyst-tab\" data-type=\"local\">\n <?php\n $rankalyst = new AT_Rankalyst_API($username, $apikey, $project_id, 3);\n if($rankalyst) {\n\t $response = $rankalyst->data();\n\t if($response) {\n\t\t if ( $response->status != 'success' ) {\n\t\t\t echo '<div class=\"rankalyst-text\"><p style=\"color: #c01313; margin-top: 10px\">' . $response->message . '</p></div>';\n\t\t } else {\n\t\t\t if ( $response->data ) {\n\t\t\t\t $data = $response->data->items;\n\t\t\t\t $rankalyst->output( $data );\n\t\t\t }\n\t\t }\n\t }\n }\n ?>\n </div>\n </div>\n <?php\n }", "public function widget( $args, $instance ){}", "public function get_widget_object($id_base)\n {\n }", "public function __construct() {\n $widget_ops = array(\n 'classname' => 'undergram-box',\n 'description' => 'Exibe as últimas fotos de qualquer perfil do Instagram.',\n );\n\n parent::__construct( 'undergram_widget', 'Instagram Box', $widget_ops );\n}", "protected function getReadSpeakerWidget() {\n\t\t$readSpeakerWidget = $this->getRenderService()->renderWidget(\n\t\t\t$this->getTypoScriptService()->getRenderObjectConfiguration()\n\t\t);\n\n\t\treturn $readSpeakerWidget;\n\t}", "static public function getView() {\n\t\treturn self::$defaultInstance;\n\t}", "function Talemy() {\n\treturn Talemy::instance();\n}", "public function get_widget_control($args)\n {\n }", "function create_triout_widget( $data ) {\n\t\t\t\t\t\t\n\t\t\t$frame .= \"<iframe src='http://trioutnc.com/u/\" . $data['widgettype'] . \".php?user=\" . $data['uid'] . \"&history=\" . $data['number'] . \"&nav=\" . $data['nav'] . \"' \";\n\t\t\t$frame .= \"width='\" . $data['width'] . \"' height='\" . $data['height'] . \"' frameborder='0' style='border:1px solid #\" . $data['border'] . \";' ></iframe>\";\n\t\t\t$frame .= \"<p style='font-family:Arial;font-size: small;padding-top:0;margin-top: 3px;'><a href='http://TriOutNC.com/u/\" . $data['uid'] . \"' target='new' style='text-decoration: none;color: #ED000F;'>Find Me</a> on <a href='http://TriOutNC.com/' target='new' style='text-decoration: none;color: #ED000F;'>TriOut!</a></p>\";\n\t\t\t\n\t\t\treturn $frame;\n\t\t}", "function i4web_toolbox($instance){\n \n $toolbox_info = $instance; \n?>\n <p><?php echo $toolbox_info['toolbox_lead_txt'];?></p>\n <ul class=\"sern-toolbox-list\">\n <li><kbd><?php echo $toolbox_info['toolbox_arr1'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr2'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr3'];?></kbd></li>\n <li><kbd><?php echo $toolbox_info['toolbox_arr4'];?></kbd></li> \n </ul>\n \n \n\t \n<?php }", "public function getControl()\r\n\t{\r\n\t\t$control=parent::getControl();\r\n\t\t$control->class[]='tag-control';\r\n\r\n\t\tif ($this->delimiter!==NULL && Strings::trim($this->delimiter)!=='') {\r\n\t\t\t$control->attrs['data-tag-delimiter']=$this->delimiter;\r\n\t\t\t}\r\n\r\n\t\tif ($this->joiner!==NULL && Strings::trim($this->joiner)!=='') {\r\n\t\t\t$control->attrs['data-tag-joiner']=$this->joiner;\r\n\t\t\t}\r\n\t\r\n\t\tif ($this->suggestCallback!==NULL) {\r\n\t\t\t$form=$this->getForm();\r\n\t\t\tif (!$form || !$form instanceof Form) {\r\n\t\t\t\tthrow new \\Nette\\InvalidStateException('TagInput supports only Nette\\Application\\UI\\Form.');\r\n\t\t\t\t}\r\n\t\t\t$control->attrs['data-tag-suggest']=$form->presenter->link($this->renderName, array('word_filter' => '%__filter%'));\r\n\t\t\t}\r\n\r\n\t\treturn $control;\r\n\t}", "function bstw() {\n\t\treturn Black_Studio_TinyMCE_Plugin::instance();\n\t}", "public function widget_instance($params) {\n if ($params['widget'] == 'admindelegation' && $this->_userCanViewWidget('admindelegation')) {\n include_once 'AdminDelegation_UserWidget.class.php';\n $params['instance'] = new AdminDelegation_UserWidget($this);\n }\n if ($params['widget'] == 'admindelegation_projects' && $this->_userCanViewWidget('admindelegation_projects')) {\n include_once 'AdminDelegation_ShowProjectWidget.class.php';\n $params['instance'] = new AdminDelegation_ShowProjectWidget($this);\n }\n \n }" ]
[ "0.62146896", "0.5792136", "0.57477295", "0.572281", "0.5649977", "0.5632038", "0.554795", "0.54234767", "0.53488743", "0.528985", "0.5289271", "0.51973015", "0.5195279", "0.51777416", "0.51638937", "0.50916487", "0.5074862", "0.5074632", "0.5060148", "0.5051824", "0.5050602", "0.50295514", "0.5017505", "0.50071555", "0.5007042", "0.49978045", "0.4985169", "0.49762252", "0.49628338", "0.49458382" ]
0.66951597
0
Get all deny rules for product
public static function getAllDenyRules($product, $sku_id = 0) { // Если требуется показать все правила скидок, невзирая на условия if ($product === null || !$product) { $product = self::getAbstractProduct(); $sku_id = 0; } $instance = get_class(); // Получаем товар if (is_int($product)) { $product = new shopProduct($product); } $product = ($product instanceof shopProduct) ? $product->getData() : $product; if (!$product) { return array(); } // Правила скидок $discount_groups = shopFlexdiscountHelper::getDiscounts(); if (!$discount_groups) { return array(); } $product = self::prepareProduct($product, $sku_id); $sku_id = $product['sku_id']; // Добавляем товар к заказу $order_params = (new shopFlexdiscountWorkflow())->addToOrder($product); self::$user = $order_params['contact']; self::setOrderInfo($order_params['order']); $items = $order_params['order']['items']; // Выполняем предварительную обработку товаров shopFlexdiscountHelper::workupProducts($items); self::getAllItems($items); $deny_rules = array(); // Фильтруем правила запрета foreach ($discount_groups as $group_id => $group) { $rules = $group_id === 0 ? $group : $group['items']; foreach ($rules as $rule) { if ($rule['deny'] && $rule['status']) { // Условия $conditions = self::decode($rule['conditions']); // Товары, удовлетворяющие условиям $result_items = $conditions ? self::filter_items($items, $conditions->group_op, $conditions->conditions) : $items; if ($result_items) { $target = self::decode($rule['target']); foreach ($target as $t) { $function_name = 'avail_target_' . $t->target; if (method_exists($instance, $function_name)) { // Товары, на которые скидка не распространяется $deny_items = self::$function_name($result_items, $items, $t, $rule, $sku_id); if ($deny_items || !$sku_id) { $deny_rules[$rule['id']] = $rule; } } } } } } } return $deny_rules; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function accessRules() {\n return array(\n array(\n 'deny',\n 'actions' => array('oauthadmin'),\n ),\n );\n }", "public function policy()\n {\n $return = array();\n\n // Itterate over policy rules\n foreach( $this->rules as $k => $v )\n {\n // If rule is enabled, add string to array\n $string = $this->get_rule_error($k);\n if( $string ) $return[$k] = $string;\n }\n\n return $return;\n }", "public function accessRules()\n\t{\n\t\t$route = Yii::app()->controller->getRoute();\n\t\t$operation = str_replace('/', '.', $route);\n\t\t\n\t\t$rulesArr = array();\n\t\t$rulesArr[] = array('allow',\n\t\t\t\t'actions'=>array($this->getAction()->id),\n\t\t\t\t'roles'=>array($operation), \n\t\t\t);\n\t\t$rulesArr[] = array('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t);\n\t\t\n\t\treturn $rulesArr;\n\t}", "function getDenyReasons() {\n return $this->denied_reasons;\n }", "public function getRulesList(){\n return $this->_get(3);\n }", "public function getRules();", "public function accessRules() {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function getRules() {}", "public function get_all_rules()\n {\n }", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('new','edit','delete','save'),\n\t\t\t\t'expression'=>array('ProductsrateController','allowReadWrite'),\n\t\t\t),\n\t\t\tarray('allow', \n\t\t\t\t'actions'=>array('index','view'),\n\t\t\t\t'expression'=>array('ProductsrateController','allowReadOnly'),\n\t\t\t),\n\t\t\tarray('deny', // deny all users\n\t\t\t\t'users'=>array('*'),\n\t\t\t),\n\t\t);\n\t}", "public function accessRules()\n {\n $acl = $this->acl;\n\n return [\n ['allow', // allow all users to perform 'index' and 'view' actions\n 'actions' => ['index', 'view'],\n 'users' => ['@'],\n ],\n ['allow', // allow authenticated user to perform 'create' and 'update' actions\n 'actions' => ['create', 'getLoadingAddressList'],\n 'expression' => function() use ($acl) {\n return $acl->canCreateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['update'],\n 'expression' => function() use ($acl) {\n return $acl->canUpdateOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['withdraw'],\n 'expression' => function() use ($acl) {\n return $acl->canWithdrawOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['restore'],\n 'expression' => function() use ($acl) {\n return $acl->canRestoreOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['accomplish'],\n 'expression' => function() use ($acl) {\n return $acl->canAccomplishOrder();\n },\n ],\n ['allow', // allow to perform 'accomplish' action\n 'actions' => ['reopen'],\n 'expression' => function() use ($acl) {\n return $acl->canReopenOrder();\n },\n ],\n ['allow', // allow to perform 'loadCargo' action\n 'actions' => ['loadCargo'],\n 'expression' => function() use ($acl) {\n return $acl->canAccessLoadCargo();\n },\n ],\n ['allow', // allow to perform 'delete' action\n 'actions' => ['delete', 'softDelete'],\n 'expression' => function() use ($acl) {\n return $acl->canDeleteOrder();\n },\n ],\n ['allow', // allow admin user to perform 'admin' action\n 'actions' => ['admin'],\n 'expression' => function() use ($acl) {\n return $acl->getUser()->isAdmin();\n },\n ],\n ['deny', // deny all users\n 'users' => ['*'],\n ],\n ];\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'expression' => 'Yii::app()->user->isAdmin()',\n ),\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules() {\n // en este array colocar solo los action de consulta\n return array(\n array('allow',\n 'actions' => array(),\n 'pbac' => array('write', 'admin'),\n ),\n array('allow',\n 'actions' => array(),\n 'pbac' => array('read'),\n ),\n // este array siempre va asì para delimitar el acceso a todos los usuarios que no tienen permisologia de read o write sobre el modulo\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "private static function getProductRules() {\n return array(\n 'price' => 'required',\n 'original_price' => 'required',\n 'quantity' => 'required',\n );\n }", "public function accessRules() {\n return VAuth::getAccessRules('package', array('getCity', 'clear', 'export', 'entry', 'input', 'childUpdate', 'index'));\n }", "public function accessRules()\r\n\t{\r\n\t\t$rules = array(\r\n\t\t\tarray( 'allow', // allow authenticated user to...\r\n\t\t\t\t'actions' => array( 'index' ),\r\n\t\t\t\t'roles' => array('question')\r\n\t\t\t),\r\n\t\t\tarray('deny',\r\n\t\t\t\t'users'=>array('*')\r\n\t\t\t\t)\r\n\t\t);\r\n\t\treturn $rules;\r\n\t}", "public function getRules(): array\n {\n if (Auth::id()==1){\n return [\n ['disk' => 'projects', 'path' => '*', 'access' => 2],\n ];\n }\n return \\DB::table('acl_rules')\n ->where('user_id', $this->getUserID())\n ->get(['disk', 'path', 'access'])\n ->map(function ($item) {\n return get_object_vars($item);\n })\n ->all();\n }", "public function accessRules(){// правила доступа к ресурсам контроллера\n $f=array();\n if(!Yii::app()->user->getState('sup')){\n $f=$this->ActionsForUser(__CLASS__);\n }\n return array(\n array('allow', // список разрешений\n 'actions'=>$f,\n 'users'=>array(Yii::app()->user->id),\n ),\n array('deny', // список запрещений\n 'users'=>array('*','$'),\n ),\n );\n }", "public function accessRules() {\n return array(\n array('allow',\n 'actions' => array('morecomments', 'approve', 'dashboard', 'create', 'list', 'update', 'delete', 'deleteall', 'index', 'view', 'replay', 'message.msg'),\n 'expression' => '$user->isAdministrator()',\n ),\n array('deny',\n 'users' => array('*'),\n )\n// array('allow', // allow all users to perform 'index' and 'view' actions\n// 'actions' => array('index', 'view'),\n// 'users' => array('*'),\n// ),\n// array('allow', // allow authenticated user to perform 'create' and 'update' actions\n// 'actions' => array('create', 'update'),\n// 'users' => array('@'),\n// ),\n// array('allow', // allow dashboard user to perform 'dashboard' and 'delete' actions\n// 'actions' => array('dashboard', 'delete'),\n// 'users' => array('dashboard'),\n// ),\n// array('deny', // deny all users\n// 'users' => array('*'),\n// ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'roles' => array('admin'),\n ),\n array('deny',\n 'users' => array('*'),\n ),\n );\n }", "public function getRules()\n {\n return $this->get(self::_RULES);\n }", "public function getRules(): Collection;", "public function accessRules()\n\t{\n\t\treturn array(\n\t\t\tarray('deny', // deny not login users\n\t\t\t\t'users'=>array('?'),\n\t\t\t),\n\t\t);\n\t}", "public function getAllowSpecific();", "public function accessRules()\n {\n \treturn array (\n \t\t\tarray (\n \t\t\t\t\t'allow',\n \t\t\t\t\t//'actions' => array ('*'),\n \t\t\t\t\t'roles' => array ('admin')\n \t\t\t),\n \t\t\tarray (\n \t\t\t\t\t'deny', // deny all users\n \t\t\t\t\t'users' => array ('*')\n \t\t\t)\n \t);\n }", "public function getAvailableRules()\n {\n return null;\n }", "public function accessRules() {\n\n // en este array colocar solo los action de consulta\n return array(\n array('allow',\n 'actions' => array('index', 'EstadisticoDirectoresDiario','ReporteDetalladoDirectoresDiario'),\n 'pbac' => array( 'write','admin'),\n ),\n array('allow',\n 'actions' => array('index', 'EstadisticoDirectoresDiario','ReporteDetalladoDirectoresDiario'),\n 'pbac' => array('read'),\n ),\n // este array siempre va asì para delimitar el acceso a todos los usuarios que no tienen permisologia de read o write sobre el modulo\n array('deny', // deny all users\n 'users' => array('*'),\n ),\n );\n }", "public function accessRules()\n {\n return array(\n array('allow',\n 'actions' => array(\n 'GetAssignedAdminNoteGridView',\n 'GetAdminNoteDialog',\n 'GetAdminGridView',\n 'GetProjectsGridView',\n 'GetNoteExternalUsersGridView',\n 'GetAdminUsers',\n 'GetProjectsDialog',\n 'GetExternalUsersDialog',\n 'GetAppInfoToShowAssignedAdmins',\n 'CopyNoteForSelectedProjects',\n 'GetAllowNoteLanguages',\n 'GetAllowNoteServices',\n 'GetNoteAsAdmin',\n 'SaveAdminNote',\n 'RemoveNote',\n 'GetNoteStatus',\n 'ChangeStatus',\n 'MarkNoteAsReadByAssignee', \n 'AddComment',\n 'ExcelExport',\n ),\n 'roles' => array('admin', 'super_admin', 'operations_admin', 'limited_admin', 'client')\n ),\n array('allow',\n 'actions' => array(\n 'GetUserGridView',\n 'MarkNoteAsReadByExternalUser',\n ),\n 'users' => array('@')\n ),\n array('deny',\n 'users' => array('*')\n )\n );\n }", "public function rules()\n\t{\n\t\t[$productType]\t= Arr::divide(config('products.products'));\n\t\treturn PaginateHelper::getRules([\n\t\t\t'product_id'\t\t=> 'array',\n\t\t\t'product_id.*'\t\t=> 'integer',\n\t\t\t'title'\t\t\t\t=> 'nullable|string|max:255',\n\t\t\t'description'\t\t=> 'nullable|string',\n\t\t\t'product_type'\t\t=> 'array',\n\t\t\t'product_type.*'\t=> 'in:'.Str::implode(',', $productType),\n\t\t\t'product_cat'\t\t=> 'array',\n\t\t\t'product_cat.*'\t\t=> 'in:'.Str::implode(',', config('products.product_cats')),\n\t\t\t'entity_id'\t\t\t=> 'array'\n\t\t],\n\t\t[\n\t\t\t'product_id',\n\t\t\t'title',\n\t\t\t'description',\n\t\t\t'product_type',\n\t\t\t'product_cat'\n\t\t],\n\t\t[\n\t\t\t'product_id',\n\t\t\t'title'\n\t\t]);\n\t}" ]
[ "0.62747824", "0.61449367", "0.6049338", "0.60105056", "0.595904", "0.590118", "0.5839226", "0.58275163", "0.5824314", "0.5819507", "0.58173406", "0.5816028", "0.5816028", "0.5793534", "0.57879716", "0.57848406", "0.57720983", "0.57696295", "0.576035", "0.57250845", "0.57121223", "0.57112116", "0.5704775", "0.5704271", "0.56917495", "0.5687037", "0.56720424", "0.56490016", "0.5646516", "0.5637094" ]
0.7084203
0
Limit available discount value
private static function limitAvailableDiscountValue($rule, $item) { // Ограничение скидки для товара if (!empty($rule['limit']['status']) && !empty($rule['limit']['value']) && $rule['limit']['value'] >= 0) { $limit = $rule['limit']; // Собираем минимальное значение цены товара $product_price_minimum = 0; switch ($limit['price1']) { case "purchase": $product_price_minimum += $item['purchase_price']; break; case "compare_price": $product_price_minimum += $item['compare_price']; break; } if ($limit['currency'] == '%') { $price2 = 0; switch ($limit['price2']) { case "purchase": $price2 += $item['purchase_price']; break; case "price": $price2 += $item['price']; break; case "compare_price": $price2 += $item['compare_price']; break; } $product_price_minimum += max(0.0, min(100.0, (float) $limit['value'])) * $price2 / 100; } else { $product_price_minimum += (float) shop_currency((float) $limit['value'], $limit['currency'], self::getOrderInfo('currency'), false); } // Если товар участвовал в скидках if (!empty(self::$available_products[$item['sku_id']][$rule['id']])) { // Размер скидки для одной единицы товара $product_discount = self::$available_products[$item['sku_id']][$rule['id']]['discount'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если размер скидки для товара больше, чем установлено ограничением if ($item['price'] - $product_discount < $product_price_minimum) { // Меняем скидку для товара self::$available_products[$item['sku_id']][$rule['id']]['discount'] = shopFlexdiscountHelper::round($item['price'] - $product_price_minimum) * self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если скидка товара ниже 0, это означает, что минимальная цена товара получилась выше самой цены товара. // Удаляем товар из массива скидок if (self::$available_products[$item['sku_id']][$rule['id']]['discount'] <= 0) { unset(self::$available_products[$item['sku_id']][$rule['id']]); } } } } // Максимальное значение бонусов для товара $maximum_product_affiliate = (isset($rule['maximum_product_affiliate']) && $rule['maximum_product_affiliate'] !== '') ? shopFlexdiscountHelper::floatVal($rule['maximum_product_affiliate']) : null; if ($maximum_product_affiliate !== null && !empty(self::$available_products[$item['sku_id']][$rule['id']])) { // Размер бонусов для одной единицы товара $product_affiliate = self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] / self::$available_products[$item['sku_id']][$rule['id']]['quantity']; // Если размер бонусов для товара больше, чем установлено ограничением if ($product_affiliate > $maximum_product_affiliate) { // Меняем бонусы для товара self::$available_products[$item['sku_id']][$rule['id']]['affiliate'] = $maximum_product_affiliate * self::$available_products[$item['sku_id']][$rule['id']]['quantity']; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetDiscountWithLimit()\n {\n $discountValue= $this->discountProvider->getDiscountValue(\"https://developer.github.com/v3/#http-redirects\",[12,7],60);\n $this->assertEquals(15,$discountValue);\n }", "function apply_special_item_discount($id, $count, &$disc_amount) {\r\n switch($id) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break; \r\n }\r\n }", "public function AssignDiscount()\n\t{\t\n\t}", "public function setDiscount(int $discount): void\n {\n $this->discount = ($discount > 0 && $discount <= 50) ? $discount : 0;\n\n }", "function apply_special_category_discount($category, $count, &$disc_amount) {\r\n switch($category) {\r\n case 99999:\r\n case 99998:\r\n if ($count > 100) {\r\n $disc_amount = 50; \r\n }\r\n break; \r\n case 99997:\r\n $disc_amount = 75;\r\n break;\r\n }\r\n }", "public function getDiscountAmount();", "function getDiscountFor($product) {\n\t\treturn 30;\n\t}", "function _apply_auto_disc()\n\t{\n\t\t$num_items = $this->cart->total_items();\n\t\t$auto_disc_info = null;\n\n\t\tforeach ($this->auto_disc_array as $cart_items => $disc_info)\n\t\t{\n\t\t\tif($num_items >= $cart_items)\n\t\t\t{\n\t\t\t\t$auto_disc_info = $disc_info;\n\t\t\t}\n\t\t}\n\n\t\t$applied_disc = $this->cart->discount_info();\n\n\t\t//auto discount should be more than the applied disc (if any)\n\t\tif($applied_disc['percentage'] < $auto_disc_info['percentage'])\n\t\t{\n\t\t\t$this->_apply_discount( $auto_disc_info['coupon'] );\n\t\t}\t\t\n\t}", "public function setDiscountAmount($value){\n return $this->setParameter('discount_amount', $value);\n }", "function fuc_discount($product, $percentage){\r\n $discountValue = $product / 100 * $percentage;\r\n $totalValue = $product - $discountValue; \r\n return $totalValue;\r\n\r\n}", "public function getDiscountInvoiced();", "function course_discounted_amount($price, $coupon)\n{\n $return_val = $price;\n if (!empty($coupon)) {\n $coupon_details = CourseCoupon::where('code', $coupon)->first();\n if (!empty($coupon_details)) {\n if ($coupon_details->discount_type === 'percentage') {\n $discount_bal = ($price / 100) * (int)$coupon_details->discount;\n $return_val = $price - $discount_bal;\n } elseif ($coupon_details->discount_type === 'amount') {\n $return_val = $price - (int)$coupon_details->discount;\n }\n }\n }\n\n return $return_val;\n}", "public function hasDiscountmax(){\n return $this->_has(33);\n }", "public function getDiscount(): int\n {\n return $this->discount;\n }", "public function getTotalDiscount(): float;", "public function getTotalDiscountAmount();", "public function getDiscountCanceled();", "public function getTonicDiscount()\n {\n }", "function calc_extra_sp_cost($Discount = 1){\r\n\t$list = array('D','E','A');\r\n\tforeach($list as $v){\r\n\t\tif(preg_match('/CostSP<([0-9]+)>/',$this->Eq[$v]['spec'],$array)){\r\n\t\t\t$a = intval($array[1]);\r\n\t\t\t$this->SP_Cost += ceil($a * $Discount);\r\n\t\t}\r\n\t}\r\n}", "public function getDiscountPriceAttribute(){\n\n if (!empty($this->discount)) {\n\n if ($this->discount->type == 'percentage') {\n $discount = ($this->price * $this->discount->discount) / 100;\n\n return round($this->price - $discount, 2);\n\n }else {\n\n return round($this->price - $this->discount->discount, 2);\n\n }\n\n }\n }", "public function discountOrChargeValueBoleta()\n {\n if($this->discount_or_charge_value > 0)\n return $this->discount_or_charge_value;\n else if ($this->discount_or_charge_percentage > 0)\n return (int) round( ($this->discount_or_charge_percentage / 100) * ($this->price * $this->quantity));\n else //pos sale without discount\n return 0;\n }", "public function getDiscount()\r\n {\r\n return $this->discount;\r\n }", "public function setDiscount(int $discount): self\n {\n $this->discount = $discount;\n return $this;\n }", "public function getBaseDiscountAmount();", "protected function calculateDiscount() : void{\r\n $percentage = ($this->discounted_value * 100) / $this->order->getTrueTotal();\r\n $new_total = $this->order->getTrueTotal() - $this->discounted_value;\r\n\r\n $this->order_discount_value = $this->discounted_value;\r\n $this->order_discount_percentage = $percentage;\r\n $this->order_discount_reason = \"For every \" . $this->products_nr . \" products from category #\" . $this->category_id . \" you get one free. You got: \";\r\n foreach($this->items_matching as $item){\r\n $this->order_discount_reason .= floor($item[\"qty\"] / $this->products_nr) . \" x '\" . $item[\"description\"] . \"' (€\". $item[\"price\"] .\" each) ; \";\r\n }\r\n $this->order_new_total = $new_total;\r\n }", "public function getDiscountAmount(){\n return $this->getParameter('discount_amount');\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }", "public function getDiscount()\n {\n return $this->discount;\n }" ]
[ "0.6956106", "0.69308144", "0.6767918", "0.6580458", "0.65567744", "0.65539926", "0.63872296", "0.63313067", "0.6296522", "0.6245726", "0.62429285", "0.6229825", "0.6217605", "0.6197916", "0.6190034", "0.61757344", "0.6168497", "0.6162909", "0.61515903", "0.61427647", "0.6128894", "0.6107512", "0.6082442", "0.6074335", "0.60737115", "0.6032997", "0.603127", "0.603127", "0.603127", "0.603127" ]
0.69675756
0
echo "SELECT hrc.`room_id`,hrc.`room_no`,hrc.`floor`,hrc.`room_type`,hrc.`adults`,hrc.`child`,hrc.`smoking`,hrtc.`room_type_id`,hrtc.`room_type_name`,hrtc.`facility_id`,hrtc.`bed_size`,hrtc.`charge`,hrtc.`note` FROM " . TABLE_HMS_ROOM_CREATION . " as hrc, " . TABLE_HMS_ROOM_TYPE_CREATION . " as hrtc WHERE hrc.`room_type` = hrtc.`room_type_id` AND hrc.`active` = 'Y' AND hrc.`room_type` = '". $room_type ."' GROUP BY hrc.`room_type`";
function roomFetchAllRecords($room_type){ $hms_info_fetch_allrec_sql = db_query("SELECT hrc.`room_id`,hrc.`room_no`,hrc.`floor`,hrc.`room_type`,hrc.`adults`,hrc.`child`,hrc.`smoking`,hrtc.`room_type_id`,hrtc.`room_type_name`,hrtc.`facility_id`,hrtc.`bed_size`,hrtc.`charge`,hrtc.`note` FROM " . TABLE_HMS_ROOM_CREATION . " as hrc, " . TABLE_HMS_ROOM_TYPE_CREATION . " as hrtc WHERE hrc.`room_type` = hrtc.`room_type_id` AND hrc.`active` = 'Y' AND hrc.`room_type` = '". $room_type ."' GROUP BY hrc.`room_no`"); return $hms_info_fetch_allrec_sql; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function showAllRoom($branch,$username,$module,$desc) {\n\necho \"\n\n<style type='text/css'>\n.head {\ncolor:white;\n}\n\n.roomData {\nfont-size:13px;\n}\n\n#selected:hover {\nbackground-color:yellow;\ncolor:black;\n}\n\n.exceeded {\nborder-color:red;\ncolor:red;\n}\n\n.unExceed {text-decoration:none; color:black; }\n.Exceed {text-decoration:none; color:red; }\n</style>\n\n\";\n\n$con = ($GLOBALS[\"___mysqli_ston\"] = mysqli_connect($this->myHost, $this->username, $this->password));\nif (!$con)\n {\n die('Could not connect: ' . ((is_object($GLOBALS[\"___mysqli_ston\"])) ? mysqli_error($GLOBALS[\"___mysqli_ston\"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));\n }\n\n((bool)mysqli_query( $con, \"USE \" . $this->database));\n\nif($module == \"BILLING\") {\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT * FROM room WHERE branch = '$branch' order by Description asc \");\n}else {\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT * FROM room WHERE branch = '$branch' and floor='$desc' order by Description asc \");\n}\necho \"<br><center><font size=2>Admitted Patient in $desc of $branch</font><div style='border:1px solid #000000; width:600px; height:auto; border-color:black black black black;'>\";\necho \"<center><br><table width='75%' border=1 cellpadding=0 cellspacing=0 rules=all>\";\necho \"<tr>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Room</font>&nbsp;</th>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Patient</font>&nbsp;</th>\";\necho \"<th bgcolor='#3b5998'>&nbsp;<font class='head'>Credit</font>&nbsp;</th>\";\necho \"</tr>\";\nwhile($row = mysqli_fetch_array($result))\n {\n $patientData = preg_split (\"/\\_/\",$this->getPatientInTheRoom($row['Description'])); //source of data\n\n $credit = $this->getCurrentCredit($patientData[0],\"PATIENT\",\"\") - ($this->getCurrentPaid($patientData[0],\"PATIENT\",\"cashUnpaid\")); //total Credit [cashUnpaid] as PATIENT\n \n $this->viewCreditLimit_setter($patientData[0],\"PATIENT\",\"cashUnpaid\",\"\"); //credit Limit ng Patient..\n $limit = $this->viewCreditLimit_setter_amountLimit(); //amountLimit ng patient from \"viewCreditLimit_setter()\"\n\necho \"<tr id='selected' >\";\n\n/*******start counter****/\n$this->showAllRoom_room++; //count total rooms\n\nif($patientData[0] != \"\") { //check kung may patient\n$this->showAllRoom_occupied+=1; // kung meron +1\n}else {\n$this->showAllRoom_vacant+=1; // kung wLa +1\n}\n\n$this->showAllRoom_credit+=$credit;\n\n/*********end counter************/\n\n\nif($this->checkCreditLimit($patientData[0]) == 0) { //check kung mei credit Limit n nka set sa patient...kpg meron execute code below kung wLa execute notifier\n\necho \"<Td>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='unExceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\n\n}else { //execute notifier kpg meron credit limit n nka set sa patient as \"PATIENT\"\n\nif($credit > $limit) { //gwen red kpg Lagpas n sa limit\n\necho \"<Td class='exceeded'>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td class='exceeded'>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='Exceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td class='exceeded'>&nbsp;</td>\";\n}\n\nif($patientData[0] != \"\") {\necho \"<Td class='exceeded'>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td class='exceeded'>&nbsp;</td>\";\n}\n\n}else { //gwen black kpg ndi n Lgpas sa limit\n\necho \"<Td>&nbsp;<font class='roomData'>\".$row['Description'].\"</font>&nbsp;</td>\";\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<a href='http://\".$this->getMyUrl().\"/Department/redirect.php?username=$username&registrationNo=\".$this->viewCreditLimit_setter_registrationNo().\"' target='_blank' class='unExceed'><font class='roomData'>\".$patientData[1].\"</font></a>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\nif($patientData[0] != \"\") {\necho \"<Td>&nbsp;<font class='roomData'>\".number_format($credit,2 ).\"</font>&nbsp;</td>\";\n}else {\necho \"<td>&nbsp;</td>\";\n}\n\n}\n\n}\n\necho \"</tr>\";\n }\n\necho \"<tr>\";\necho \"<td>&nbsp;<font size=2><b>\".$this->showAllRoom_room.\" Rooms</b></font>&nbsp;</td>\";\necho \"<td>&nbsp;<font size=2>Occupied&nbsp;<b>\".$this->showAllRoom_occupied.\"</b>&nbsp;|&nbsp;Vacant&nbsp;<b>\".$this->showAllRoom_vacant.\"</b></font>&nbsp;</td>\";\necho \"<td>&nbsp;<font size=2><b>\".number_format($this->showAllRoom_credit,2).\"</b></font>&nbsp;</td>\";\necho \"</tr>\";\necho \"</table>\";\necho \"<br>\";\necho \"</div>\";\n}", "function CNS_Showroom(){\n $this->db->select(\"*\");\n $this->db->from(\"Showroom\"); \n $query = $this->db->get();\n return $query->result_array();\n }", "function load_room_name($conn)\n{\n\t$output='';\n\t$edit_room_id=$_POST['Edit-room'];\n\t\n\t$query1 = \"SELECT * FROM room where ROOM_ID= $edit_room_id \";\n\t$result1 = mysqli_query($conn,$query1);\n\twhile($row = mysqli_fetch_array($result1)) \n\t{\n\t\t\n\t\t$output=$row[\"ROOM_NAME\"];\n\t}\n\treturn $output;\n}", "function getRooms(){\n\t\t$stmt = $this->connect->prepare(\"SELECT id,Name,RoomNo, Description from roominfo\");\n\t\t$stmt->execute();\n\t\t$stmt->bind_result($id, $name, $RoomNo, $Description);\n\t\t\n\t\t$rooms = array(); \n\t\t\n\t\twhile($stmt->fetch()){\n\t\t\t$room = array();\n\t\t\t$room['id'] = $id; \n\t\t\t$room['Name'] = $name; \n\t\t\t$room['RoomNo'] = $RoomNo; \n $room['Description'] = $Description; \n\t\t\tarray_push($rooms, $room); \n\t\t}\n\t\t\n\t\treturn $rooms; \n\t}", "function getRoomtypesDH ($forSelect = false) {\n\t\tglobal $wpdb;\n\t\t$roomtypes = array();\n\t\t$res = mysql_query('SELECT id, name, minimum, capacity, price, discription FROM '.$wpdb->prefix.DATABASE_PREFIX.'roomtypes ORDER by menuorder');\n\t\twhile ($row = mysql_fetch_assoc($res)) {\n\t\t\t$roomtypes[intval($row['id'])] = $forSelect ? \"{$row['name']} ({$row['capacity']})\" : $row;\n\t\t\tif (!$forSelect)\n\t\t\t\tunset($roomtypes[$row['id']]['id']);\n\t\t}\n\t\treturn $roomtypes;\n}", "public function index(){\n // $Room = Room::all();\n // dd($Room);\n // SELECT roomtype FROM `rooms` WHERE roomtype = \"single\"\n // $Room = DB::table('rooms')\n // ->select('rooms.roomType', 'rooms.id')\n // ->get();\n // dd($Room);\n $Rooms = DB::table('rooms')\n ->select('rooms.roomType')\n ->distinct()\n ->get();\n\n\n // dd($Rooms);\n return view('reservation/searchRoomF',['Rooms' => $Rooms]);\n}", "function car_hire(){\n //\n $sql= $this->chk(\n \"SELECT \n vehicle.reg_no,\n vehicle.model,\n vehicle.rate\n FROM \n vehicle \"\n );\n // \n $car_hire= $this->sqlData($sql);\n echo ($car_hire);\n }", "function getRoomType($result){\n\t\t//get record corresponding to that id_vehicle\n\t\t\t\t\t//$data=$this->Common_model->select_fields_where($tbl, '*', array('id_vehicle'=>$result), true);\n\t\t$tbl=$this->session->userdata('prefix').'roomtypes';\n\t\t$where=array($tbl.'.id_room'=>$result);\n\t\t// get the db tables list\n\t\t$tableList=getTables(); // define in custom helper\n\t\t// check if the tbl exist in db \n\t\tif(in_array($tbl, $tableList)){\n\t\t\t$data=$this->Common_model->select_fields_where($tbl, '*', $where, true);\n\t\t\treturn $data;\n\t\t} \n\n\t}", "function createRoomDropDown($dbSelected) {\n $tSQLselect = \"SELECT \";\n $tSQLselect .= \"loc_room \";\n $tSQLselect .= \"FROM \";\n $tSQLselect .= \"nhi_locations \";\n $tSQLselect .= \"order by loc_room \";\n\n\n $tSQLselect_Query = mysqli_query($dbSelected, $tSQLselect);\n\n $DropDown = \"\";\n $DropDown .= \" <option value=\\\"\\\">\\n\";\n while ($row = mysqli_fetch_assoc($tSQLselect_Query)) {\n\n foreach ($row as $idx => $r) {\n $DropDown .= \" <option value=\\\"$r\\\">\\n\";\n }\n }\n mysqli_free_result($tSQLselect_Query);\n\n return $DropDown;\n}", "function getRoomsAvailable(){\n\n global $db;\n\n $stmt= $db->prepare('SELECT room_id,branch\n FROM (\n SELECT room_id,\n room_branch AS branch\n FROM room\n WHERE NOT EXISTS (\n SELECT employee_room_id\n FROM employee\n WHERE employee_room_id = room_id\n )\n )');\n\n $stmt->execute();\n return $stmt->fetchAll();\n \n }", "function find_room1($date='',$pm_id = 0,$propertyroomid=0){\r\n\tglobal $db;\r\n\t$count =0;\r\n\tglobal $tblprefix;\r\n\t$new_date = date(\"m/d/Y\",strtotime($date));\r\n\t$qry_room = \"SELECT no_of_rooms FROM \".$tblprefix.\"advance_date WHERE pm_id=\".$pm_id.\" AND room_type_id=\".$propertyroomid.\" AND advance_date='\".$new_date.\"'\";\r\n \r\n $rs_room = $db->Execute($qry_room);\r\n return $rs_room->fields['no_of_rooms'];\r\n\r\n}", "public function getAllRooms()\n {\n $db = PDOController::getInstance();\n $req = $db->prepare('SELECT roomtypes.name, rooms.id, rooms.name AS roomName, services.name AS serviceName\n FROM rooms JOIN roomtypes ON roomtypes.id= rooms.type_id\n JOIN services ON services.id=rooms.service_id');\n $req->execute([]);\n \n return $req->fetchAll();\n }", "public function getPatientInTheRoom($room) {\n\n$con = ($GLOBALS[\"___mysqli_ston\"] = mysqli_connect($this->myHost, $this->username, $this->password));\nif (!$con)\n {\n die('Could not connect: ' . ((is_object($GLOBALS[\"___mysqli_ston\"])) ? mysqli_error($GLOBALS[\"___mysqli_ston\"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));\n }\n\n((bool)mysqli_query( $con, \"USE \" . $this->database));\n\n$result = mysqli_query($GLOBALS[\"___mysqli_ston\"], \"SELECT upper(pr.lastName) as lastName,upper(pr.firstName) as firstName,rd.registrationNo FROM patientRecord pr,registrationDetails rd WHERE pr.patientNo = rd.patientNo and rd.room = '$room' and rd.dateUnregistered = '' \");\nwhile($row=mysqli_fetch_array($result)) {\nreturn $row['registrationNo'].\"_\".$row['lastName'].\", \".$row['firstName'];\n}\n\n}", "function get_water_pumped_history($order_id){\r\n $configs = include('config/config.php');\r\n $query = \"SELECT * FROM \" . $vogomo_pump_water_history_table . \" WHERE oid='\" . $order_id . \"' AND action='water_pumped'\";\r\n //echo $query;\r\n $result = $configs->query($query);\r\n return $result;\r\n}", "public function getAllRoom(){\n $query = \"select * from $this->rooms_tableName where 1\";\n $result = $this->dbh->query($query);\n if($result->rowCount() > 0){\n return $result->fetchAll();\n }\n return null;\n }", "function getAvailHistory($conn){\r\n\t$cid = $_SESSION['uid'];\r\n\t$sql = \"SELECT a.aid, a.ato, a.afrom, a.ptype FROM availability a, bid b WHERE a.cid = '$cid' AND a.aid = b.aid AND b.status = 'successful'\";\r\n\t$result = pg_query($conn, $sql);\r\n\twhile ($row = pg_fetch_assoc($result)) {\r\n\t\t\t\techo \"<div class='panel panel-warning'><div class='panel panel-heading'><h3>\";\r\n\t\t\t\techo $row['ptype'];\r\n\t\t\t\techo \"</div><div class='panel panel-body'>\";\r\n\t\t\t\techo \"From \".$row['afrom'].\"</h3>\".\" to \".$row['ato'];\r\n\t\t\tshowSuccessfulBidders($conn, $row['aid']);\r\n\t\techo \"</div></div>\";\r\n\t}\r\n\t\r\n}", "function eateries(){\n $sql= $this->chk(\n \"SELECT \n eatery.name,\n eatery.description,\n eatery.rate\n FROM \n eatery \"\n );\n // \n $eateries= $this->sqlData($sql);\n echo ($eateries);\n }", "static function get_records_from_display_table($camp_id, $type){\n\t\tglobal $wpdb;\n\t\t$tables = self::get_tables_name();\n\t\textract($tables);\n\t\t$camp_id = (int) $camp_id;\n\t\t\n\t\t$sql = \"SELECT content FROM $display WHERE camp_id = $camp_id AND type = '$type'\";\n\t\t\n\t\t$return = $wpdb->get_col($sql);\n\t\tif($return){\n\t\t\treturn implode(', ', $return);\n\t\t}\n\t\t\n\t\treturn '';\n\t\t\n\t}", "function print_Vehicles(){\n $result = $this->query(\"SELECT * FROM VEHICLES\");\n while($row = mysqli_fetch_array($result)) {\n echo $row['TAG'] . \" \" . $row['MODEL'] . \" \" . $row['EMPLOYEE'];\n echo \"<br>\";\n }\n \n $result->close();\n }", "function displayStudy($tpl, $pid){\n $result = db_query(\"select A.begin_course_cd, B.begin_course_name from `take_course` A, `begin_course` B, `lrtunit_basic_` C\n where\n\t A.personal_id=$pid and\n\t\t B.begin_course_cd=A.begin_course_cd and\n\t\t\t C.unit_cd=B.begin_unit_cd and\n\t\t\t\t A.allow_course=1 and\n\t\t\t\t (A.course_end > NOW() or A.course_end is NULL) and\n\t\t\t\t B.note IS NOT NULL order by B.attribute\");\n\nwhile(($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) != false){\n $tpl->append(\"all_course\", $row);\n }\n}", "function load_room_groups($options=array())\n{\n\tglobal $db;\n\n\t$where = \"WHERE 1\";\n\n\tif(isset($options['sort asc']))\n\t\t$sort = \"ORDER BY \".$options['sort asc'];\n\telse if(isset($options['sort desc']))\n\t\t$sort = \"ORDER BY \".$options['sort desc'];\n\telse\n\t\t$sort = \"ORDER BY ordering,name\";\n\n\n\t// load room_groups\n\t$select = \"SELECT * FROM room_groups $where AND active LIKE '1' $sort\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\t$all_room_groups = array();\n\twhile($res->fetchInto($room_group))\n\t{\n\t\t$all_room_groups[$room_group->id] = $room_group;\n\t}\n\treturn($all_room_groups);\n}", "private function _getBaseQuery($type): string {\n $stmt = 'SELECT ';\n\n switch($type) {\n case 'resources':\n $stmt .= '`basePrice`, `dependantFactories`, `maxRate`';\n break;\n case 'factories':\n $stmt .= '`cashPerHour`, `dependantFactories`, `dependencies`, `scaling`, `requiredAmount`, `upgradeMaterial`, `upgradeMaterialAmount`';\n break;\n case 'loot':\n $stmt .= '`recyclingDivisor`, `recyclingProduct`, `recyclingAmount`';\n break;\n case 'units':\n $stmt .= '`requirements`, `requiredAmount`, `baseStrength`';\n break;\n case 'headquarter':\n $stmt .= '`amount`, `material`, `boost`, `radius`';\n break;\n case 'buildings':\n $stmt .= '`level`, `material`, `materialAmount0`, `materialAmount1`, `materialAmount2`, `materialAmount3`';\n break;\n case 'settings':\n $stmt .= '`setting`, `value`, `description`';\n break;\n }\n\n $stmt .= ' FROM `' . $type . '` ORDER BY `id` ASC';\n\n return $stmt;\n }", "public function sparooms($type=\"sparoom\")\n {\n\n $query=$this->sparoomquery();\n return DB::select(DB::raw($query));\n /*return $sparoom = DB::table(\"opos_ftype\")\n ->leftJoin(\"opos_lockerkeytxnsparoom\",\"opos_lockerkeytxnsparoom.sparoom_ftype_id\",\"=\",\"opos_ftype.id\")\n ->whereNull(\"opos_ftype.deleted_at\")\n \n /* ->whereNull(\"opos_lockerkeytxnsparoom.sparoom_checkout\")*/\n /* ->whereNotNull(\"opos_lockerkeytxnsparoom.sparoom_checkin\")*/\n /*->where(\"opos_ftype.ftype\",$type)\n\n ->orderBy('opos_ftype.fnumber','ASC')\n ->select(\"opos_ftype.*\",\"opos_lockerkeytxnsparoom.sparoom_checkin\",\"opos_lockerkeytxnsparoom.sparoom_checkout\")\n ->get();*/\n }", "function load_rooms($room_ids=null,$options=array())\n{\n\tglobal $db;\n\n\t$room_limiter = \"\";\n\tif($room_ids)\n\t{\n\t\tif(is_array($room_ids))\n\t\t{\n\t\t\tforeach($room_ids as $room_id)\n\t\t\t{\n\t\t\t\t$room_limiter .= \" AND id LIKE '$room_id'\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$room_limiter .= \"AND id like '$room_ids'\";\n\t\t}\n\t}\n\n\tif(isset($options['id']))\n\t{\n\t\t$room_limiter .= \"AND id like '\".$options['id'].\"'\";\n\t}\n\n\tif(isset($options['room_number']))\n\t{\n\t\t$room_number_limiter .= \"AND room_number like '\".$options['room_number'].\"'\";\n\t}\n\n\tif(isset($options['out_of_order']))\n\t{\n\t\t$room_number_limiter .= \"AND out_of_order like '\".$options['out_of_order'].\"'\";\n\t}\n\n\tif(isset($options['capacity']))\n\t{\n\t\t// separate capacity range into low-high thresholds\n\t\t$capacity_parts = explode(\"-\",$options['capacity']);\n\t\t$capacity_low = $capacity_parts[0];\n\t\t$capacity_high = $capacity_parts[1];\n\t\t$room_number_limiter .= \"AND capacity >= '$capacity_low' AND capacity <= '$capacity_high'\";\n\t}\n\n\tif(isset($options['capacity gte']))\n\t{\n\t\t$room_number_limiter .= \"AND capacity >= '\".$options['capacity gte'].\"'\";\n\t}\n\n\n\tif(isset($options['sort asc']))\n\t\t$sort = \"ORDER BY \".$options['sort asc'];\n\telse if(isset($options['sort desc']))\n\t\t$sort = \"ORDER BY \".$options['sort desc'];\n\telse\n\t\t$sort = \"ORDER BY capacity,room_number\";\n\n\tif(isset($options['limit']))\n\t\t$limit = \"LIMIT \".$limit;\n\telse\n\t\t$limit = \"\";\n\n\t$select = \"SELECT * FROM study_rooms WHERE 1 $room_limiter $room_number_limiter AND active like '1' $sort $limit\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\t$all_rooms = array();\n\twhile($res->fetchInto($room))\n\t{\n\t\t$room->amenities = array();\n\t\t$room->keys = array();\n\t\t$room->room_number = ltrim($room->room_number,'0');\n\n\t\t$all_rooms[$room->id] = $room;\n\t}\n\n\tprint(\"select: $select<br>\\n\");\n\n\t$room_limiter = str_replace(\"AND id\",\"AND room_id\",$room_limiter);\n\n\t$all_amenities = load_amenities();\n\n\t// load amenity associations\n\t$select = \"SELECT * FROM study_rooms_amenities WHERE 1 $room_limiter AND active like '1' ORDER BY ordering,id\";\n\t//print(\"select: $select<br>\\n\");\n\t$res = $db->query($select);\n\twhile($res->fetchInto($room_amenity))\n\t{\n\t\tif(isset($all_rooms[$room_amenity->room_id]))\n\t\t{\n\t\t\tif(isset($all_amenities[$room_amenity->amenity_id]))\n\t\t\t{\n\t\t\t\t$amenity = $all_amenities[$room_amenity->amenity_id];\n\t\t\t\t$room_amenity->name = $amenity->name;\n\t\t\t\t$room_amenity->description = $amenity->description;\n\t\t\t\t$room_amenity->search_filter = $amenity->search_filter;\n\t\t\t\t$all_rooms[$room_amenity->room_id]->amenities[] = $room_amenity;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tif(isset($options['amenities and']))\n\t{\n\t\t// remove rooms that don't match all amenity filters\n\t\tforeach($all_rooms as $room_id => $room)\n\t\t{\n\t\t\tforeach($options['amenities and'] as $amenity)\n\t\t\t{\n\t\t\t\t$a_ok = false;\n\t\t\t\tforeach($room->amenities as $ra)\n\t\t\t\t{\n\t\t\t\t\tif($ra->amenity_id == $amenity)\n\t\t\t\t\t{\n\t\t\t\t\t\t$a_ok = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($a_ok)\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// amenity was not found for this room, remove room from results\n\t\t\t\t\tunset($all_rooms[$room_id]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// load images\n\t$select = \"select * from room_images where 1 $room_limiter AND active like '1' order by ordering,id\";\n\t$res = $db->query($select);\n\twhile($res->fetchInto($room_image))\n\t{\n\t\tif(isset($all_rooms[$room_image->room_id]))\n\t\t{\n\t\t\t$image_location = \"images/rooms/\".$room_image->room_id.\"/\".$room_image->type.$room_image->room_id.\"_\".$room_image->id;\n\t\t\tswitch($room_image->format)\n\t\t\t{\n\t\t\t\tcase 'image/jpeg': $extension = \"jpg\"; break;\n\t\t\t\tcase 'image/png': $extension = \"png\"; break;\n\t\t\t\tcase 'image/gif': $extension = \"gif\"; break;\n\t\t\t\tdefault: $extension = str_replace(\"images/\",\"\",$room_image->format);\n\t\t\t}\n\t\t\t$image_location .= \".\".$extension;\n\t\t\t$room_image->location = $image_location;\n\t\t\t$all_rooms[$room_image->room_id]->images[$room_image->type][] = $room_image;\n\t\t}\n\t}\n\n\t// load keys\n\t$select = \"select * from rooms_keys where 1 $room_limiter AND active like '1'\";\n\t$res = $db->query($select);\n\twhile($res->fetchInto($key))\n\t{\n\t\tif(isset($all_rooms[$key->room_id]))\n\t\t{\n\t\t\t$all_rooms[$key->room_id]->keys[] = $key;\n\t\t}\n\t}\n\n\t$return = array();\n\tif(isset($options['group_by']))\n\t{\n\t\t$group_by = $options['group_by'];\n\t\tforeach($all_rooms as $room_id => $room)\n\t\t{\n\t\t\t$return[$room->$group_by][$room->id] = $room;\n\t\t}\n\t}\n\telse\n\t{\n\t\t$return = $all_rooms;\n\t}\n\n\treturn($return);\n}", "public function get_rooms()\n\t\t{\n\t\t\t$this->db->where(\"room_active\",1);\n\t\t\t$rooms = $this->db->get(\"rooms\");\n\t\t\treturn $rooms;\n\t\t}", "public function getSQL(){\n $sqlString = \"select \";\n $campos = $this->getCampos();\n //var_dump($campos);\n if (is_array($campos) && empty($campos)) {\n $sqlString .= \" * \";\n } else {\n $campos = \"\";\n foreach ($this->getCampos() as $key => $value) {\n if (!$campos == \"\") { \n $campos.=\" ,\"; \n };\n $campos.=\" \".$value.\" as \".$key.\" \";\n }\n $sqlString .= $campos;\n }\n $sqlString .= \" from \" . $this->getTabla();\n if ( $this->getSQLFilter() != \"\" ) {\n $sqlString .= \" where \" . $this->getSQLFilter();\n }\n \n $sqlString .= $this->getSQLGroupBy();\n $sqlString .= $this->getSQLOrderBy();\n //echo $sqlString.\"\\n\";\n return $sqlString; \n }", "function floorplan_cat_name($field)\n{\n$cms=mysql_fetch_array(mysql_query(\"select floor_catname from manage_floor_category where fcat_id='\".$field.\"'\"));\nreturn $cms['floor_catname'];\n}", "static function getBedcountReport( $selectedDate, $allocJobId ) {\n global $wpdb;\n\n $sql = \"SELECT room, capacity, room_type, \n -- these are the room types in the bedcounts for HSH\n\t\t\t\t\tCASE WHEN capacity = 2 THEN 'Double/Twin'\n\t\t\t\t\tWHEN capacity = 4 THEN 'Quad/4 Bed Dorm'\n\t\t\t\t\tWHEN capacity BETWEEN 16 AND 18 THEN '16-18 Bed Dorm'\n\t\t\t\t\tWHEN capacity BETWEEN 6 AND 12 THEN '6-12 Bed Dorm'\n\t\t\t\t\tELSE 'Unknown' END AS hsh_room_type,\n -- magnify private rooms based on size of room\n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_empty * capacity, num_empty) `num_empty`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_staff * capacity, num_staff) `num_staff`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_paid * capacity, num_paid) `num_paid`, \n IF(room_type IN ('DBL','TRIPLE','QUAD','TWIN'), num_noshow * capacity, num_noshow) `num_noshow`\n FROM (\n -- room 30/paid beds is split into separate rooms for some reason; collapse them\n SELECT IF(p.room_type = 'PAID BEDS', 'PB', p.room) `room`, IF(p.room_type = 'PAID BEDS', 8, p.capacity) `capacity`, p.room_type,\n SUM(IF(p.reservation_id IS NULL AND p.room_type != 'PAID BEDS', 1, 0)) `num_empty`,\n SUM(IF(p.reservation_id = 0, 1, 0)) `num_staff`, \n SUM(IF(p.lh_status IN ('checked-in', 'checked-out', 'checked_in', 'checked_out') AND p.reservation_id > 0, 1, 0)) `num_paid`, \n SUM(IF(IFNULL(p.lh_status, '') NOT IN ('checked-in', 'checked-out', 'checked_in', 'checked_out') AND p.reservation_id > 0, 1, 0)) `num_noshow`\n FROM (\n SELECT rm.room, rm.bed_name, rm.capacity, rm.room_type, c.reservation_id, c.payment_outstanding, c.guest_name, c.notes, c.lh_status\n FROM wp_lh_rooms rm\n LEFT OUTER JOIN \n ( SELECT cal.* FROM wp_lh_calendar cal, (select %s AS selection_date) const\n WHERE cal.job_id = %d -- the job_id to use data for\n AND cal.checkin_date <= const.selection_date\n AND cal.checkout_date > const.selection_date\n ) c \n -- if unallocated (room_id = null), then ignore this join field and match on room_type_id\n ON IFNULL(c.room_id, rm.id) = rm.id AND IFNULL(IF(c.room LIKE 'PB(%', 'PB', c.room), 'Unallocated') = rm.room AND c.room_type_id = rm.room_type_id\n\t\t\t\t\tWHERE rm.active_yn = 'Y' OR rm.room_type = 'PAID BEDS' OR rm.room = 'Unallocated'\n ) p\n GROUP BY IF(p.room_type = 'PAID BEDS', 'PB', p.room), p.capacity, p.room_type\n ) t\n -- only include Unallocated if we have something to report\n WHERE room != 'Unallocated'\n -- 2018-06-17: don't include unallocated anymore; throws off count in cloudbeds\n -- OR ((room_type = 'PAID BEDS' OR room = 'Unallocated') AND (num_staff > 0 OR num_paid > 0 OR num_noshow > 0))\n ORDER BY room\";\n\n // HSH bedcounts are actually by room type\n if( get_option('blogname') == 'High Street Hostel Bookings' ) {\n $sql = \"SELECT GROUP_CONCAT(room ORDER BY room SEPARATOR ', ') AS room,\n hsh_room_type AS room_type, \n SUM(capacity) AS capacity,\n\t\t SUM(num_empty) AS num_empty, SUM(num_staff) AS num_staff, SUM(num_paid) AS num_paid, SUM(num_noshow) AS num_noshow\n FROM ( $sql ) hsh\n GROUP BY CRC32(hsh_room_type) -- some weirdness with MariaDB here\n ORDER BY capacity\";\n }\n else {\n // for paid beds, the \"paid\" category doesn't need to be \"checked-in\"\n $sql = \"SELECT room, capacity, room_type, num_empty, num_staff,\n IF(room = 'PB', num_paid + num_noshow, num_paid) AS num_paid,\n IF(room = 'PB', 0, num_noshow) AS num_noshow\n FROM ( $sql ) bc\";\n }\n\n $resultset = $wpdb->get_results($wpdb->prepare(\n $sql, $selectedDate->format('Y-m-d H:i:s'), $allocJobId ));\n\n if($wpdb->last_error) {\n throw new DatabaseException($wpdb->last_error);\n }\n\n return $resultset;\n }", "function displayOptions(){\n global $dbConn;\n $sql = 'SELECT DISTINCT (category) FROM p1_quotes';\n $statement = $dbConn->prepare($sql); \n $statement->execute();\n $records = $statement->fetchAll();\n foreach ($records as $record) {\n echo '<option>' . $record[\"category\"] . '</option>';\n }\n}", "function get_type_name($type_name) {\nglobal $db;\n$query = 'SELECT * FROM types\n WHERE typeID = :type_id';\n$statement = $db->prepare($query);\n$statement->bindValue(':type_id', $type_id);\n$statement->execute();\n$type = $statement->fetch();\n$type_name = $type['vehicleTypes'];\n$statement->closeCursor();\nreturn $type_name;\n}" ]
[ "0.62165904", "0.6080373", "0.59947807", "0.5870859", "0.5832687", "0.5784368", "0.5756885", "0.57293993", "0.57280064", "0.5640402", "0.55528164", "0.5521277", "0.5479622", "0.5429577", "0.5407253", "0.5391274", "0.5389326", "0.5387009", "0.53830487", "0.53813696", "0.5365722", "0.53620416", "0.53576785", "0.535125", "0.53352773", "0.532297", "0.5320995", "0.5308397", "0.5271498", "0.5269238" ]
0.7341497
0
Provide the character separation the project name from the issue number, may be different for merge requests
public static function getProjectIssueSeparator($isMergeRequest) { return '-'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIssuePrefix() : string;", "public abstract function getProjectName();", "public static function getProjectIssueSeparator($isMergeRequest)\n {\n return $isMergeRequest ? '!' : '#';\n }", "function get_forge_project_name()\n\t{\n\t\treturn '';\n\t}", "public function getProjectName() : string\n {\n return $this->projectName;\n }", "public function projectName() : string\n {\n return (string) $this->getOrError('name');\n }", "protected function getNewProjectName() {\n\t\tdo {\n\t\t\t$t_name = $this->getName() . '_' . rand();\n\t\t\t$t_id = $this->client->mc_project_get_id_from_name( $this->userName, $this->password, $t_name );\n\t\t} while( $t_id != 0 );\n\t\treturn $t_name;\n\t}", "public function getProjectId(): string\n {\n return $this->_projectId;\n }", "private function getIssuesPageTitle(): string\n {\n return $this->app->translator->translate('issues.title');\n }", "public static function issueName(string $project, string $location, string $issueModel, string $issue): string\n {\n return self::getPathTemplate('issue')->render([\n 'project' => $project,\n 'location' => $location,\n 'issue_model' => $issueModel,\n 'issue' => $issue,\n ]);\n }", "public function getProjectTitle();", "public abstract function getProjectFieldName();", "private function getProjectNameAndProjectID(){\r\n $this->jsonOutput[\"projectID\"] = utils\\Encryption::encode($this->settingVars->projectID);\r\n $this->jsonOutput[\"projectName\"] = $this->settingVars->pageArray[\"PROJECT_NAME\"];\r\n }", "public static function getProjectName()\n {\n $name = array();\n $items = Cart::getCart();\n foreach($items as $key => $item) {\n $name[] = $item['title'];\n }\n \n return implode(', ', $name);\n }", "public function whenMessageMatches(): ?string\n {\n $projects = explode(',', env('JIRA_PROJECTS', ''));\n\n $projects = collect($projects);\n\n if ($projects->isNotEmpty()) {\n return sprintf(\n '(?<issue>(?<project>%s)\\-(?<id>[0-9]+))',\n $projects->implode('|')\n );\n }\n\n return null;\n }", "public static function projectName(string $project): string\n {\n return self::getPathTemplate('project')->render([\n 'project' => $project,\n ]);\n }", "public static function projectName(string $project): string\n {\n return self::getPathTemplate('project')->render([\n 'project' => $project,\n ]);\n }", "function getProjectName($con, $inpProj)\n\t{\n\t\t$sql_projName = $con->prepare(\"SELECT projectName FROM projects WHERE projectID = ?\");\n\t\t$sql_projName->bind_param(\"i\", $inpProj);\n\t\t$sql_projName->execute();\n\n\t\t$result_projName = $sql_projName->get_result();\n\n\t\twhile($row = mysqli_fetch_array($result_projName))\n\t\t{\n\t\t\t$projName = $row['projectName'];\n\t\t}\n\n\t\treturn $projName;\n\t}", "public static function label()\n {\n return 'Projects';\n }", "public function getProjectNameWithCustomerName($projectId, $glue = \" - \") {\n\n\t\t$project = $this->getProjectById($projectId);\n\t\t$projectName = $project->getCustomer()->getName() . $glue . $project->getName();\n\n\t\treturn $projectName;\n\t}", "public function get_name() {\n return get_string('circleci', 'assignsubmission_circleci');\n }", "public function fetchProjectID(): string;", "public function getName()\n {\n return 'vlad_bugtracker_issue';\n }", "public function getIssueNumber()\n {\n return $this->getParameter('issueNumber');\n }", "private function getProjectTitle($user_id, $level_id)\n\t{\n\t\t// Check if reference to this project is stored\n\t\t$db = JFactory::getDBO();\n\t\t$query = $db->getQuery(true)\n\t\t\t->select($db->qn('pf_projects_id'))\n\t\t\t->from($db->qn('#__akeebasubs_pf4_projects'))\n\t\t\t->where($db->qn('users_id') . ' = ' . $db->q($user_id))\n\t\t\t->where($db->qn('akeebasubs_level_id') . ' = ' . $db->q($level_id));\n\t\t$db->setQuery($query);\n\t\t$proj_id = $db->loadResult();\n\t\tif($proj_id == null) return \"\";\n\t\t\n\t\t// Get the title\n\t\t$query = $db->getQuery(true)\n\t\t\t->select($db->qn('title'))\n\t\t\t->from($db->qn('#__pf_projects'))\n\t\t\t->where($db->qn('id') . ' = ' . $db->q($proj_id));\n\t\t$db->setQuery($query);\n\t\t$proj_title = $db->loadResult();\n\t\tif($proj_title == null) return \"\";\n\t\t\n\t\treturn $proj_title;\n\t}", "public static function retrieveProjectTitle($projectID) {\n try {\n $project = ArmyDB::retrieveProjectInfo($projectID);\n //var_dump($unit);\n return $project['projectname'];\n }\n catch (Exception $e) {\n throw new Exception($e->getMessage());\n }\n }", "public function getProjectId() {\n if (isset($this->project_id)) {\n return $this->project_id;\n }\n\n $repoApi = new \\Drupal\\config_pr_gitlab\\RepoControllers\\GitLabApi($this->getClient());\n $path = '/api/v4/projects/?scope=projects&search=' . rawurlencode($this->repo_name) . '&owned=true';\n $response = $repoApi->get($path);\n if (is_array($response)) {\n foreach ($response as $item) {\n if ($item['path'] == $this->repo_name) {\n $this->project_id = $item['id'];\n break;\n }\n }\n }\n }", "public function getMenuAddLabel()\n {\n return t('Add a new Github Issue');\n }", "public function getIssueNumber()\n {\n return $this->issue_number;\n }", "function getBugPath ($bug)\n {\n $project = ServiceUtil::getProjectByID ($bug['project_id']);\n $category = $project['category'];\n\n $path = '';\n if ($project)\n $path = $project['name'];\n\n $path .= \"/$category\";\n\n return $path;\n }" ]
[ "0.6409201", "0.62410223", "0.6235086", "0.6232383", "0.6191263", "0.6130725", "0.60237056", "0.6015594", "0.58794904", "0.5871256", "0.58393794", "0.5826795", "0.57452464", "0.57138175", "0.562946", "0.5593079", "0.5593079", "0.55403495", "0.55237025", "0.55163467", "0.5498883", "0.54442006", "0.542346", "0.53988844", "0.53806704", "0.52213174", "0.5218061", "0.51793116", "0.5169748", "0.5125348" ]
0.63528866
1
Get the total of issues currently imported by retrieveAllIssues() This may be an estimated number
public function getTotalIssuesBeingImported() { return $this->total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function totalIssues()\n {\n $url = $this->base_uri.'search?jql=project='.$this->project.'&startAt=0&maxResults=0';\n $issues = $this->request($url);\n if (!$this->infos['errorBoolean']) {\n return json_decode($issues)->total;\n }\n }", "protected function getTotal()\n {\n $total = 0;\n foreach ($this->entries as $entry) {\n $total += $entry['price'] * $entry['quantity'];\n }\n\n return $total;\n }", "public function total(): int\n {\n return count($this->all());\n }", "public function getTotal(): int\n {\n if (isset($this->contents)) {\n return count($this->contents);\n }\n\n return 0;\n }", "public function getTotal() : int\n {\n return $this->total;\n }", "public function getTotalEntries()\n {\n return $this->totalEntries;\n }", "public function getTotal():int{\r\n\t return (int)$this->_vars['total_items']??0;\r\n\t}", "public function getTotalEstimated() {\n\t\t$total = 0;\n\t\t$this->costitem->get();\n\t\tforeach($this->costitem->all as $item) {\n\t\t\tif ($item->item_type == 'price') {\n\t\t\t\t$total += $item->amount;\n\t\t\t}\n\t\t}\n\t\treturn $total;\n\t\t\n\t}", "function getTotal() {\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "public function getTotal()\n\t{\n\t\t// Lets load the 'pending' records of the view instead of the existing records list\n\t\tif ($this->_pending)\n\t\t{\n\t\t\tif ($this->_total_pending === null)\n\t\t\t{\n\t\t\t\t$query = $this->_buildQuery();\n\n\t\t\t\tif ($query === false)\n\t\t\t\t{\n\t\t\t\t\treturn $this->_total_pending = 0;\n\t\t\t\t}\n\n\t\t\t\t$this->_getList($query, 0, 1);\n\t\t\t\t$this->_db->setQuery(\"SELECT FOUND_ROWS()\");\n\t\t\t\t$this->_total_pending = $this->_db->loadResult();\n\t\t\t}\n\n\t\t\treturn $this->_total_pending;\n\t\t}\n\n\t\t// Lets load the records if it doesn't already exist\n\t\telseif ($this->_total === null)\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\n\t\t\tif ($query === false)\n\t\t\t{\n\t\t\t\treturn $this->_total = 0;\n\t\t\t}\n\n\t\t\t$this->_getList($query, 0, 1);\n\t\t\t$this->_db->setQuery(\"SELECT FOUND_ROWS()\");\n\t\t\t$this->_total = $this->_db->loadResult();\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal() {\r\n\t\tif (empty ( $this->_total )) {\r\n\t\t\t$query = $this->_buildQuery ();\r\n\t\t\t$this->_total = $this->_getListCount ( $query );\r\n\t\t}\r\n\t\treturn $this->_total;\r\n\t}", "public function getTotalInquiries()\n {\n $AdminDashboardModel = $this->model('AdminDashboardModel');\n $this->totalInquiries = $AdminDashboardModel->getTotalInquiries();\n }", "public function getTotal() {\n\t\treturn $this->find('count', array(\n\t\t\t'contain' => false,\n\t\t\t'recursive' => false,\n\t\t\t'cache' => $this->alias . '::' . __FUNCTION__,\n\t\t\t'cacheExpires' => '+24 hours'\n\t\t));\n\t}", "public static function totalNumber()\n {\n return (int)self::find()->count();\n }", "function getTotal()\n\t{\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query); \n\t\t}\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\t\treturn $this->_total;\n\t}", "function getTotal()\r\n{\r\n if (empty($this->_total))\r\n {\r\n $query = $this->_buildQuery();\r\n $this->_total = $this->_getListCount($query);\r\n }\r\n \r\n return $this->_total;\r\n}", "public function getTotal()\n\t{\n\t\t\n\t\treturn count($this->findAll());\n\t}", "public function totalResults()\n {\n\t\treturn (int) $this->totalResultsReturned;\n }", "public function getTotalResults()\n {\n return isset($this['info']['results'])\n ? (int) $this['info']['results']\n : 0;\n }", "function getTotal()\r\n\t{\r\n\t\tif( empty($this->_total) )\r\n\t\t{\r\n\t\t\t$this->_total\t= $this->_getListCount( $this->_query() );\r\n\t\t}\r\n\r\n\t\treturn $this->_total;\r\n\t}", "public function getTotal(): int;", "public function getTotal() {\n\t\treturn $this->total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "public function getTotal()\n\t{\n\t\treturn $this->total;\n\t}", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }" ]
[ "0.83486587", "0.6618601", "0.65681076", "0.6443894", "0.64355946", "0.64127195", "0.6370253", "0.6367052", "0.63533825", "0.6346644", "0.6345541", "0.63357216", "0.63295615", "0.6322821", "0.62981313", "0.6297393", "0.62857234", "0.6277588", "0.6273738", "0.62620693", "0.62547183", "0.62526417", "0.6249581", "0.6236187", "0.6236187", "0.6236187", "0.6228846", "0.6221908", "0.6221908", "0.6221908" ]
0.86565197
0
Get a list of all organisations a user is member of
public function getListOfAllUserOrganisations() { return ['All projects']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function all()\n {\n return $this->get('/user/memberships/orgs');\n }", "public function listOrganizations($user) {\n return $user->organizations;\n }", "public function get_organisers(){\n $sql = \"SELECT DISTINCT * from members WHERE members.id IN \"\n .\"(SELECT organiserID FROM tournamentOrganisers WHERE tournamentID=$this->id)\";\n return Member::find_by_sql($sql);\n }", "public function getListOfAllUserOrganisations()\n {\n $groups = $this->makeSingleGitLabGetRequest('/groups');\n\n return array_map(function ($group) {\n return $group['full_path'];\n }, $groups);\n }", "public function getAllOrganizations()\n {\n $sql = \"SELECT * FROM organization\";\n $values=array();\n $org=$this->getInfo($sql,$values);\n return $org;\n }", "public function organizers()\n {\n return $this->members()->wherePivot('role', '=', Member::ROLE_ORGANIZER)->get();\n }", "function getOrganismsList();", "public function getOrgUsers(){\n $return_array = array();\n $current_campaign=Yii::app()->session->get('current_campaign');\n $campaign = Definition::model()->findByPk($current_campaign);\n if($campaign){\n $users = Users::model()->findAllByAttributes(array('fk_org_id'=>$campaign->fk_org_id));\n foreach($users as $user){\n $return_array[$user->id] = $user->username;\n }\n }\n \n return $return_array;\n }", "public function getOrganisationList()\n {\n return $this->getResponse('/v1/organizations/list');\n }", "public function getOrganisations(){\n $organisations = [];\n foreach ($this->data['items'] as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = IndexSanityCheckHelper::indexSanityCheck('uid', $organisation);\n $newOrganisation['name'] = IndexSanityCheckHelper::indexSanityCheck('name', $organisation);\n $newOrganisation['uri'] = IndexSanityCheckHelper::indexSanityCheck('uri', $organisation);\n $newOrganisation['country_code'] = IndexSanityCheckHelper::indexSanityCheck('country', $organisation);\n $newOrganisation['gst_registered'] = IndexSanityCheckHelper::indexSanityCheck('gstRegistered', $organisation);\n $newOrganisation['access_flag'] = IndexSanityCheckHelper::indexSanityCheck('UIAccessFlags', $organisation);\n $newOrganisation['migrated'] = IndexSanityCheckHelper::indexSanityCheck('migrationStatus', $organisation);\n array_push($organisations, $newOrganisation);\n }\n\n return $organisations;\n }", "public function getOrganisations($id = false)\n {\n return !$id ? $this->call('get','Organisations') : $this->call('get','Organisations/'.$id);\n }", "public function getAllOrgs()\n {\n $sql = \"SELECT * FROM organization\";\n $values=array();\n \n $orgs=$this->getInfo($sql,$values);\n\n return $orgs;\n }", "public function findAll() {\n $sql = \"select * from organisations\";\n $result = $this->getDb()->fetchAll($sql);\n \n // Convert query result to an array of domain objects\n $organisations = array();\n foreach ($result as $row) {\n $organisationId = $row['id_organisation'];\n $organisations[$organisationId] = $this->buildDomainObject($row);\n }\n return $organisations;\n }", "public function getMembers()\n {\n \t$companyId = session('company_id');\n \t$userRepo = $this->em->getRepository('App\\Entity\\Management\\User');\n \t$users = $userRepo->getUsersByCompany($companyId);\n\n echo json_encode($users);\n\n }", "public function getOrganisations(){\n $organisations = [];\n if (array_key_exists('items', $this->data)) {\n foreach ($this->data['items'] as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('uid', $organisation);\n $newOrganisation['name'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('name', $organisation);\n $newOrganisation['uri'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('uri', $organisation);\n $newOrganisation['country_code'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('country', $organisation);\n $newOrganisation['gst_registered'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('gstRegistered', $organisation);\n $newOrganisation['access_flag'] = 'old_essentials';\n array_push($organisations, $newOrganisation);\n }\n } else {\n foreach ($this->data as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = IndexSanityCheckHelper::indexSanityCheck('Id', $organisation);\n $newOrganisation['name'] = IndexSanityCheckHelper::indexSanityCheck('Name', $organisation);\n $newOrganisation['uri'] = IndexSanityCheckHelper::indexSanityCheck('Uri', $organisation);\n $newOrganisation['country_code'] = IndexSanityCheckHelper::indexSanityCheck('Country', $organisation);\n $newOrganisation['gst_registered'] = true;\n $newOrganisation['access_flag'] = IndexSanityCheckHelper::indexSanityCheck('UIAccessFlags', $organisation);\n array_push($organisations, $newOrganisation);\n }\n }\n\n\n return $organisations;\n }", "public function getCompanyWithUsers();", "public function OrganisationMembers() {\n\t\t$memberIDs = $this->RelatedMembers()\n\t\t\t->filter(['Type.Code' => ['MJO', 'MRO', 'MEM', 'MCO']])\n\t\t\t->column('FromModelID');\n\n\t\t$uniquemembers = Member::get()->filter(['ID' => $memberIDs])->distinct(true)->setQueriedColumns(array('ID'));\n\n\t\treturn $uniquemembers;\n\t}", "public function getOrderUsersOrganisms() {\n // Load the list items.\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n // Select the required fields from the table.\n $query->select('org.id as id, org.name as name');\n $query->from('#__sdi_order AS o');\n $query->innerJoin('#__sdi_user AS sdi_user ON sdi_user.id = o.user_id');\n $query->innerJoin('#__sdi_user_role_organism AS uro ON sdi_user.id = uro.user_id AND uro.role_id = 1');\n $query->innerJoin('#__sdi_organism AS org ON org.id = uro.organism_id');\n $query->order('org.name');\n $query->group('org.id');\n $query->group('org.name');\n\n try {\n $items = $this->_getList($query);\n } catch (RuntimeException $e) {\n $this->setError($e->getMessage());\n return false;\n }\n return $items;\n }", "public function ApproverMembers() {\n\t\tif ($this->owner->CanApproveType == 'OnlyTheseUsers') {\n\t\t\t$groups = $this->owner->ApproverGroups();\n\t\t\t$members = new DataObjectSet();\n\t\t\tif($groups) foreach($groups as $group) {\n\t\t\t\t$members->merge($group->Members());\n\t\t\t}\n\t\t\t\n\t\t\t// Default to ADMINs, if something goes wrong\n\t\t\tif(!$members->Count()) {\n\t\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\t\t$members = $group->Members();\n\t\t\t}\n\t\t\t\n\t\t\treturn $members;\n\t\t} elseif($this->owner->CanApproveType == 'LoggedInUsers') {\n\t\t\treturn Permission::get_members_by_permission('CMS_ACCESS_CMSMain');\n\t\t} else {\n\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\treturn $group->Members();\n\t\t}\n\t}", "public function getAllOrganisation()\n {\n //\n $organisation = Organisation::get()->where('deleted_at', NULL);\n if(count($organisation) > 0){\n return response([\n \"status\" => \"success\",\n \"message\" => \"Organisations List\",\n \"organisation\" => $organisation,\n \"code\" => 200\n ], 200);\n }\n else{\n return response([\n \"status\" => \"failed\",\n \"message\" => \"Organisations Not Found\",\n \"organisation\" => $organisation,\n \"code\" => 400\n ], 404);\n }\n \n }", "public function index()\n {\n $organisations = Organisation::all();\n return $organisations->toJson();\n }", "public function myOrganizations($user_id = null){\n $this->Behaviors->load('Containable');\n $myOrganizations = $this->find('all', array(\n 'contain' => array(\n 'Organization.Organizationmessage',\n 'Organization.Organizationmessage.User',\n 'User',\n 'Branch',\n 'Organizationrole',\n 'Organization.City',\n 'Organization.Country',\n 'Branch.City',\n 'Branch.Country'\n ),\n 'conditions'=>array(\n 'OrganizationUser.user_id'=> $user_id,\n 'OrganizationUser.status'=>3\n )\n ));\n return $myOrganizations;\n }", "public function organisations()\n {\n return $this->belongsToMany('Queueless\\Organisation')->withTimestamps();\n }", "public static function getOrganizationList(Request $request)\n {\n $organizations = User::all();\n $all = $organizations->count();\n $active = count($organizations->where('deleted_at', '=', null)->all()); \n $softDelete = \\App\\Organization::onlyTrashed()->count();\n return $organization = collect(['active' => $active, 'softDelete' => $softDelete, 'all' => $all]);\n }", "public function index()\n {\n return OrganizerResource::collection(\n Auth::user()->organizers\n );\n }", "public function get_users($organization_id, $user_type);", "public function getUsers();", "public function getUsers();", "public function getUsers();", "private function getUsers()\n {\n $url = $this->base_uri.'user/assignable/multiProjectSearch?projectKeys='.$this->project;\n $users = $this->request($url);\n if (!$this->infos['errorBoolean']) {\n return json_decode($users);\n }\n }" ]
[ "0.76634663", "0.7379162", "0.7372059", "0.70723677", "0.698785", "0.6977385", "0.696514", "0.68578535", "0.684014", "0.664089", "0.6487919", "0.64069617", "0.6307691", "0.62922287", "0.62767303", "0.62561554", "0.61909", "0.6177162", "0.6159785", "0.61528057", "0.61368436", "0.6129262", "0.61209667", "0.60822713", "0.60694957", "0.6068707", "0.59797686", "0.59797686", "0.59797686", "0.5971866" ]
0.75359803
1
/desc:generate authcode /input:arg(email,code_type(1register,2change password,3change email,4change phone),user_type,user_id) /output:return(authcode,errorcode(1success,0failed))
function generate_authcode_email($email,$code_type=0,$user_id="",$user_type=Constant::USER_TYPE_TEACHER,$check=true) { $authcode=""; if($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id); else $errorcode=array('errorcode'=>false); if(!$errorcode['errorcode']) { $authcode=random_string('unique'); $data=$this->bind_verify($user_id,$email,"",1,$code_type,$authcode,$user_type); if($this->_redis) { $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL); $this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL); } else { $this->db->insert($this->_table,$data); $insert_id=$this->db->insert_id(); if($insert_id>0) $errorcode=true; else $errorcode=false; } log_message('trace_tizi','170018:Gen email auth code',array('email'=>$email)); if(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email)); } else { $errorcode=false; } return array('authcode'=>$authcode,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function generate_password_activation_code($id,$email){\r\n \r\n \r\n $this->load->helper('string');\r\n \r\n $data = array(\r\n 'forgot_password_code' => random_string('unique'),\r\n 'forgot_password_code_expire' => date('Y-m-d H:i:s',strtotime(\"+24 hours\"))\r\n ); \r\n $this->db->update('members', $data, array('id' => $id,'aes_decrypt(email,salt)' => $email));\r\n $this->db->last_query();\r\n return $data['forgot_password_code'];\r\n }", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "public function passwordResetCode();", "function generate_validation_code()\n {\r\n return hash_hmac($this->hash_function, $this->email,\r\n $this->created_at.hash($this->hash_function, $this->password));\r\n }", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "public function getNewAuthCode()\n {\n // TODO: Implement getNewAuthCode() method.\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function activationCode();", "public function generateSignCodes() {\n $users = $this->connection->fetchAll('SELECT * FROM [reg_users]');\n \n if ($users) {\n foreach ($users as $user) {\n $data = array(\n 'signin_hash%s' => $this->generateUserHash($user, 'sign_in'),\n 'signoff_hash%s' => $this->generateUserHash($user, 'sign_off')\n );\n \n $this->connection->query('UPDATE [reg_users] SET', $data, 'WHERE [user_id] = %i', $user['user_id']);\n }\n }\n \n }", "private function generate_code() {\n\t\t$secret = $this->code_generator->createSecret();\n\t\t$code = $this->code_generator->getCode($secret);\n\t\treturn array('secret'=>$secret, 'code'=>$code);\n\t}", "function password_change($email) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//get the id of the user\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//generate verification code\n\t\t$verification_code = hash(\"sha256\", microtime() . (string)rand() . $email);\n\n\t\t//get data required for email\n\t\t$change_link = \"https://swapitg.com/changepassword/$verification_code\";\n\t\t$subject = \"Change Passsword\";\n\t\t$mailfile = fopen(__DIR__ . \"/change_password_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/change_password_mail_template.html\")), array('$change_link' => $change_link));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\t//set the verification code\n\t\t\t$sql = \"UPDATE user SET verification_code = :verification_code, code_generation_time = CURRENT_TIMESTAMP WHERE id = :id\";\n\t\t\t$sth = $pdo->prepare($sql);\n\t\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t\t$sth->execute();\n\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 3;\n\t\t}\n\t}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "function emailpasswordresetcode($username, $email){\n\t$to=$email;\n\t$errortype = 98;\n\t$errorcode = generateerrorcode($username,$email);\n\t$db=usedb();\n\t//make sure the user provided input is safe\n\t$username=mysqli_real_escape_string($db, $username);\n\t$email=mysqli_real_escape_string($db, $email);\n\t$errorcode=mysqli_real_escape_string($db, $errorcode);\n\t$sql=<<<SQL\n\t\tUPDATE users\n\t\tSET users.PassWord=MD5('$errorcode'), users.ErrorType=$errortype, users.ErrorCode='$errorcode'\n\t\tWHERE (users.UserName='$username' AND users.Email='$email')\nSQL;\n\tmysqli_query($db, $sql);\n\t$rows=mysqli_affected_rows($db);\n\tif(!$rows){\n\t\tmysqli_close($db);\n\t\treturn 0;\n\t}else{//the update was successful so we can try to get the display name and sent the email\n\t\t$sql=<<<SQL\n\t\t\tSELECT users.DisplayName\n\t\t\tFROM users\n\t\t\tWHERE (users.UserName = '$username')\nSQL;\n\t\t$result = mysqli_query($db, $sql);\n\t\t$rows = mysqli_num_rows($result);\n\t\tmysqli_close($db);\n\t\tif(!$rows){\n\t\t\treturn 0;\n\t\t}else{\t//if we have an author with that id\n\t\t\t//get the information in the result\n\t\t\t$assoc = mysqli_fetch_assoc($result);\n\t\t\t$displayname = $assoc['DisplayName'];\n\t\t\t//Send the email\n\t\t\t$subject=\"Collabor8r Password Reset\";\n\t\t\t$helpaddress=emailaddress(\"help\");\n\t\t\t$header=\"From: Collabor8r User Services <$helpaddress>\";\n\t\t\t$text = <<<TEXT\nDear $displayname,\nAs per your request, we have reset your password.\nTemporary Password: $errorcode\nUpon logging in with this password, you will need to change your password to regain access to all of our services.\nThank you for your continued patronage. If you ever have suggestions about our services, please don't hesitate to contact us.\nThe CollaboR8R Team.\nIf you did not request this email, please forward this it to [email protected].\nTEXT;\n\t\t\tmail($to,$subject,$text,$header);\n\t\t\treturn 1;\n\t\t}\n\t}\n\t//if we get past the point, the email didn't get sent so return 0\n\treturn 0;\n}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "private function generateForgotPasswordCode($email)\n {\n try {\n $forgot_password_code = $this->generateRandomString(self::FORGOT_PASSWORD_CODE_LENGTH);\n $db_query = $this->db->prepare(\"UPDATE users SET forgot_password_code=:forgot_password_code \n WHERE email=:email AND verified=1 LIMIT 1\");\n $db_query->bindParam(':forgot_password_code', $forgot_password_code);\n $db_query->bindParam(':email', $email);\n $db_query->execute();\n if ($db_query->rowCount()) {\n return $forgot_password_code;\n }\n } catch (PDOException $e) {\n DBErrorLog::loggingErrors($e);\n return false;\n }\n }" ]
[ "0.7041306", "0.6664811", "0.6414264", "0.63870126", "0.6328473", "0.6225655", "0.6189174", "0.6171091", "0.6162935", "0.61328924", "0.6098717", "0.6017145", "0.600179", "0.5996775", "0.5996761", "0.5988542", "0.59841704", "0.59823465", "0.5956479", "0.5842074", "0.5827205", "0.5816619", "0.58070964", "0.5806655", "0.5740081", "0.57265145", "0.571888", "0.5707291", "0.56881493", "0.56847256" ]
0.73247254
0
/desc:generate authcode /input:arg(phone,code_type(1register,2change password),user_type,user_id) /output:return(authcode,errorcode(1success,0failed))
function generate_authcode_phone($phone,$code_type=0,$user_id="",$user_type=Constant::USER_TYPE_TEACHER) { $authcode=""; $errorcode=$this->check_authcode_phone($phone,$code_type); if(!$errorcode['errorcode']) { $authcode=random_string('nozero',6); $data=$this->bind_verify($user_id,"",$phone,2,$code_type,$authcode,$user_type); if($this->_redis) { $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE); $this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE); } else { $this->db->insert($this->_table,$data); $insert_id=$this->db->insert_id(); if($insert_id>0) $errorcode=true; else $errorcode=false; } log_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone)); if(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone)); } else { $errorcode=false; } return array('authcode'=>$authcode,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "public function passwordResetCode();", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "function generate_validation_code()\n {\r\n return hash_hmac($this->hash_function, $this->email,\r\n $this->created_at.hash($this->hash_function, $this->password));\r\n }", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function getNewAuthCode()\n {\n // TODO: Implement getNewAuthCode() method.\n }", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function generate_otp_code(){\n return rand(1000,9999);\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "private function generate_code() {\n\t\t$secret = $this->code_generator->createSecret();\n\t\t$code = $this->code_generator->getCode($secret);\n\t\treturn array('secret'=>$secret, 'code'=>$code);\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "public function createVerificationCode()\n {\n return $code = random_int(config('twilio-verify.random_int.initial_value'), config('twilio-verify.random_int.final_value'));\n }", "public function generateOTPCode()\n {\n return generate_otp_code();\n }", "abstract public function getPaymentAuthorizationCode();", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function rest_authorization_required_code()\n {\n }", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "public function get_user_code()\n\t{\n\t\t$q_select_id = \"SELECT MAX(id) FROM tb_users\";\n\t\t$last_id = DB::connect()->query($q_select_id)->fetch_column();\n\t\tterner(not_filled($last_id), $last_id = 0, $last_id); // if last id is 0 then give it 0 value\n\n\t\t// get last user_code second number from tb_users\n\t\t$q_select_ucode = \"SELECT\n\t\t\tid as id,\n\t\t\tSUBSTR(user_code, 2, 1) as ucode\n\t\tFROM tb_users ORDER BY id DESC LIMIT 1\";\n\t\t$get_ucode_num = DB::connect()->query($q_select_ucode)->style(FETCH_ASSOC)->fetch();\n\t\tterner($get_ucode_num['ucode'] == 9, ($last_ucode = 0), ($last_ucode = 1 + $get_ucode_num['ucode'])); // if ucode reach 9 then reset it to 0\n\n\t\t// generate user code and setting up variables\n\t\t$gen_user_code = 2 . $last_ucode . $last_id;\n\t\t$user_code = $gen_user_code;\n\n\t\treturn $user_code;\n\t}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "public function activationCode();" ]
[ "0.6973977", "0.68567944", "0.653663", "0.6469809", "0.6230544", "0.6160553", "0.6155896", "0.6071113", "0.606184", "0.6061542", "0.60458225", "0.6037689", "0.5979467", "0.595551", "0.59494174", "0.5949014", "0.59301543", "0.5901704", "0.5869621", "0.58634496", "0.5858948", "0.58327526", "0.58236843", "0.58167034", "0.5814327", "0.5761703", "0.5755713", "0.5754493", "0.5747124", "0.57183665" ]
0.79321396
0
/desc:check authcode time /input:arg(user_id,code_type,email) /output:return(errorcode(1success,0failed))
function check_authcode_email($email,$code_type,$user_id="") { if($email) { if($this->_redis) { $errorcode=$this->check_auth('email',$email); } else { $this->db->select("id"); $this->db->from($this->_table); $this->db->where("email",$email); $this->db->where("code_type",$code_type); $this->db->where("has_verified",0); $this->db->where("generate_time >",date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s")." -".Constant::SEND_AUTHCODE_INTERVAL_EMAIL))); $query=$this->db->get(); $total=$query->num_rows(); if($total>0) $errorcode=true; else $errorcode=false; } } else { $errorcode=true; } return array("errorcode"=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "public function checkCode(User $user, $code);", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function checkCode(TwoFactorInterface $user, $code);", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "public function check_activity( $code=NULL){\n\t\tif( $code!=NULL){\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'account_active' => '0',\n\t\t\t), TRUE);\n\t\t\treturn($user);\n\t\t}\n\t\treturn false;\n\t\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "public function validation($data)\n {\n \t$this->load->library('encrypt');\n\t\t$user = $this->db->select('email, password, status_register')->where('email', $data['email'])->get('ec_client')->result_array();\n if (count($user) > 0) {\n\t\t\t\t$password_decode = $this->encrypt->decode($user[0]['password']);\n\t\t\t\t\tif ($password_decode == $data['password']) {\n\t\t\t\t\t\tif ($user[0]['status_register'] == 0) {\n return 2;\n }\n return 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t}\n }", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function verifyTwoFACode($code) {\n $verification = Yii::app()->db->createCommand()\n ->select('code')\n ->from('x2_twofactor_auth')\n ->where('userId = :id AND requested >= :requested', array(\n ':id' => $this->id,\n ':requested' => time() - (60 * 5), // within the past 5 minutes\n ))->queryScalar();\n return $code === $verification;\n }", "function code_checkCodeUser($bdd, $CodeID, $userID)\n\t{\n\t\techo_debug('CODE code_checkCodeUser | codeID='.$CodeID.' userID='.$userID.'<br>');\n\t\ttry\n\t\t{ \n\t\t\t$response = $bdd->prepare('SELECT userID FROM code WHERE id=:ci');\n\t\t\t$response->execute(array(\n\t\t\t\t'ci' => $CodeID\n\t\t\t));\n\t\t}\t\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\tdie('Error : '.$e->getMessage());\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\t$nb_rows = $response->rowCount();\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\t$nb_rows = 0;\n\t\t}\n\t\t\n\t\t$codeUser=0;\n\t\t$check=FALSE;\n\t\tif($nb_rows > 0)\n\t\t{\n\t\t\twhile ($data = $response->fetch())\n\t\t\t{\n\t\t\t\t$codeUser = $data['userID']; \t\n\t\t\t}\n\t\t\tif($codeUser !=0 && $codeUser==$userID)\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return TRUE<br>');\n\t\t\t\t$check= TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return FALSE - This code does not belong to the user<br>');\n\t\t\t\t$check=FALSE;\t\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo_debug('CODE code_checkCodeUser | return FALSE Code not found<br>');\n\t\t\t$check=FALSE;\t\t\t\n\t\t}\n\t\t\n\t\treturn $check;\n\t}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "public function CheckingUserLaunchSubmit($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameLaunchKey($sid);\n $member = (string)($uid.':'.$gameid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$member);\n if (empty($value))\n {\n // not flag here.\n $errcode = 0;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 0;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode;\n if ( GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT <= $dt )\n {\n // not timeout select invalid.\n $errcode = 0;\n break;\n }\n $errcode = 1;\n }while(FALSE);\n return $errcode;\n }", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}" ]
[ "0.70175093", "0.6671944", "0.6636695", "0.6557928", "0.65566397", "0.64303976", "0.64200485", "0.639658", "0.63700753", "0.6228954", "0.6207038", "0.60789436", "0.60712767", "0.60692966", "0.60504144", "0.6032281", "0.6017066", "0.5968752", "0.59380555", "0.5934535", "0.59291726", "0.59005636", "0.58983314", "0.5897438", "0.58845764", "0.58701247", "0.58621556", "0.58539015", "0.58488697", "0.5845289" ]
0.7296355
0
/desc:check authcode time /input:arg(user_id,code_type,phone) /output:return(errorcode(1success,0failed))
function check_authcode_phone($phone,$code_type,$user_id="") { if($phone) { if($this->_redis) { $errorcode=$this->check_auth('phone',sha1($phone)); } else { $this->db->select("id"); $this->db->from($this->_table); $this->db->where("phone",sha1($phone));//需要通过服务获得加密后的电话号码 $this->db->where("code_type",$code_type); $this->db->where("has_verified",0); $this->db->where("generate_time >",date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s")." - ".Constant::SEND_AUTHCODE_INTERVAL_PHONE))); $query=$this->db->get(); $total=$query->num_rows(); if($total>0) $errorcode=true; else $errorcode=false; } } else { $errorcode=true; } return array("errorcode"=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "public function checkCode(User $user, $code);", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function checkCode(TwoFactorInterface $user, $code);", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_reffer_code() {\n\t\t$reffer_code = $_REQUEST['reffer_code'];\n\t\tif (!empty($reffer_code)) {\n\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t$user_id = $reffer_records[0]['user_id'];\n\t\t\t\t$user_reffer_code = $reffer_records[0]['user_refferal_code'];\n\n\t\t\t\t//if($user_reffer_code==$reffer_code){\n\t\t\t\tif (strcmp($user_reffer_code, $reffer_code) == 0) {\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code, 'user_id' => $user_id);\n\t\t\t\t} else {\n\t\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\", 'reffer_code' => $reffer_code);\n\t\t}\n\t\techo $this -> json($post);\n\t}", "public function verifyTwoFACode($code) {\n $verification = Yii::app()->db->createCommand()\n ->select('code')\n ->from('x2_twofactor_auth')\n ->where('userId = :id AND requested >= :requested', array(\n ':id' => $this->id,\n ':requested' => time() - (60 * 5), // within the past 5 minutes\n ))->queryScalar();\n return $code === $verification;\n }", "public function check_activity( $code=NULL){\n\t\tif( $code!=NULL){\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'account_active' => '0',\n\t\t\t), TRUE);\n\t\t\treturn($user);\n\t\t}\n\t\treturn false;\n\t\t}", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "private function checkData() {\n if(!isset(\n $_POST['code'],\n $_POST['field']\n )) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong request'\n ));\n exit;\n }\n\n if($_POST['field']==='email') {\n $field = 'email';\n }\n elseif($_POST['field']==='phone') {\n $field = 'cellphone';\n }\n else {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong field'\n ));\n exit;\n }\n\n $code=trim($_POST['code']);\n\n $user_id=$this->uSes->get_val('user_id');\n if (isset(\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['code'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field][$field]\n )) {\n if($field==='cellphone'&&!(int)$this->uFunc->getConf('use MAD SMS to send SMS','content',false)) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'sms send is not supported'\n ));\n exit;\n }\n\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp']<(time()-300)) {//5min\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'code is expired'\n ));\n exit;\n }\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['code']!==$code) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong code'\n ));\n exit;\n }\n\n $password=$_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'];\n\n $value=$_SESSION['uAuth']['profile_update_bg']['change'.$field][$field];\n\n $this->updateEmailOrPhone($user_id,$field,$value,$password);\n\n unset($_SESSION['uAuth']['profile_update_bg']['change'.$field]);\n\n return $value;\n }\n\n print json_encode([\n 'status'=>'error',\n 'msg'=>'code is expired'\n ]);\n exit;\n }", "abstract public function checkCode(string $uuid, string $code, int $successFlag = self::NOTHING_ON_SUCCESS);", "function verify_code($rec_num, $checkstr)\n\t{\n\t\tif ($user_func = e107::getOverride()->check($this,'verify_code'))\n\t\t{\n\t \t\treturn call_user_func($user_func,$rec_num,$checkstr);\n\t\t}\n\t\t\n\t\t$sql = e107::getDb();\n\t\t$tp = e107::getParser();\n\n\t\tif ($sql->db_Select(\"tmp\", \"tmp_info\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\")) {\n\t\t\t$row = $sql->db_Fetch();\n\t\t\t$sql->db_Delete(\"tmp\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\");\n\t\t\t//list($code, $path) = explode(\",\", $row['tmp_info']);\n\t\t\t$code = intval($row['tmp_info']);\n\t\t\treturn ($checkstr == $code);\n\t\t}\n\t\treturn FALSE;\n\t}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function CheckUserPermission($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameSelectKey($sid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$sid);\n if (empty($value))\n {\n // not flag here.\n $errcode = 1;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 2;\n break;\n }\n if ($l_obj->launchid != $uid)\n {\n // uid not match.\n $errcode = 3;\n break;\n }\n if ($l_obj->gameid != $gameid)\n {\n // gameid not match.\n $errcode = 4;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode_select;\n if ($dt >= GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT)\n {\n // timeout permission invalid.\n $errcode = 5;\n break;\n }\n $errcode = 0;\n }while(FALSE);\n return $errcode;\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "public function handleActivationCode($user, $code) {\n $uac = UserActivationCode::where('user_id', $user->id)\n ->where('code', $code)\n ->orderBy('expiration', 'DESC')\n ->first();\n if ($uac) {\n if ($uac->expiration < time()) {\n return \"Your code is expired. Please try to get verification code by clicking send email link.\";\n }\n $user->status = config('sc.user_status.active');\n $user->save();\n $uac->forceDelete();\n return true;\n }\n\n return \"Invalid Activation Code\";\n }", "public function CheckingUserLaunchSubmit($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameLaunchKey($sid);\n $member = (string)($uid.':'.$gameid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$member);\n if (empty($value))\n {\n // not flag here.\n $errcode = 0;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 0;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode;\n if ( GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT <= $dt )\n {\n // not timeout select invalid.\n $errcode = 0;\n break;\n }\n $errcode = 1;\n }while(FALSE);\n return $errcode;\n }" ]
[ "0.66229653", "0.66124845", "0.6599462", "0.65965307", "0.65910935", "0.6551686", "0.6520834", "0.64820313", "0.6337884", "0.6298369", "0.62243575", "0.622435", "0.620291", "0.61889225", "0.6100215", "0.6006341", "0.59979546", "0.5992259", "0.5990905", "0.59638214", "0.5889765", "0.58876854", "0.5873436", "0.58620036", "0.58605295", "0.582169", "0.5786451", "0.57753783", "0.5775156", "0.57625675" ]
0.7295115
0
/desc:send authcode /input:arg(authcode,phone) /output:phone,return(errorcode(1success,0failed))
function send_authcode_phone($authcode,$phone,$code_type=0) { $this->load->library('sms'); $msg_head=$msg_end=$lang=''; switch($code_type) { case Constant::CODE_TYPE_REGISTER: $lang="verify";break; case Constant::CODE_TYPE_CHANGE_PASSWORD: $lang="reset";break; case Constant::CODE_TYPE_CHANGE_PHONE: $lang="update_phone";break; default:break; } if($lang) { $msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang)); $msg_end=$this->lang->line('phone_end_'.$lang); } $msg=$msg_head.$authcode.$msg_end; $this->sms->setPhoneNums($phone); $this->sms->setContent($msg); $sms_error=$this->sms->send(); if($sms_error['error']=="Ok") { $errorcode=true; log_message('info_tizi','170111:Sms send success',$sms_error); } else { $errorcode=false; if($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone'); else $sms_error['error']=$this->lang->line('error_sms_normal'); log_message('error_tizi','17011:Sms send failed',$sms_error); } return array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t$mobile = \"0\" . $mobile_no;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t$msg = \"Recharge Verification Code : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient=$mobile&message=\" . $encodedMessage;\n\t\t// $url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n\t\t// CURLOPT_POSTFIELDS => $postData\n\t\tCURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t\t//echo $output;\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function forget_send_code($mobile){\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t $code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t $mobileNumber = substr($mobile, 1);\n\t\t $msg = \"New Password of Recharge login : \" . $code;\n $encodedMessage = urlencode($msg);\n $route = \"4\";\n $authKey = \"109829ANu1kqLdg570b4e25\";\n $senderId = \"Recharge\";\n $postData = array(\n 'authkey' => $authKey,\n 'mobiles' => $mobileNumber,\n 'message' => $encodedMessage,\n 'sender' => $senderId,\n 'route' => $route\n);\n $url=\"http://api.msg91.com/api/sendhttp.php\";\n $ch = curl_init();\ncurl_setopt_array($ch, array(\n CURLOPT_URL => $url,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postData\n ,CURLOPT_FOLLOWLOCATION => true\n));\n// \n// \n// //Ignore SSL certificate verification\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n curl_close($ch);\n\t\treturn $code;\n\t}", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "public static function sendCode($phone){\n // $c->appkey = getConfig('sms_appkey');\n // $c->secretKey = getConfig('sms_secret');\n // $req = new AlibabaAliqinFcSmsNumSendRequest;\n // $req->setExtend();\n // $req->setSmsType(\"normal\");\n // $req->setSmsFreeSignName(getConfig('sms_FreeSignName'));\n // $code = self::setCode($phone);\n // $req->setSmsParam(\"{\\\"name\\\":\\\"\".$code.\"\\\"}\");\n // $req->setRecNum($phone);\n // $req->setSmsTemplateCode(getConfig('sms_TemplateCode'));\n // $resp = $c->execute($req);\n // if (@$resp->code){\n // return response()->json([\n // 'status' => false,\n // 'errmsg' => $resp->sub_msg\n // ]);\n // }else{\n // return response()->json([\n // 'status' => true,\n // 'message' => '发送成功'\n // ]);\n // }\n\n // 初始化阿里云config\n AliyunConfig::load();\n // 初始化用户Profile实例\n $profile = DefaultProfile::getProfile(\"cn-hangzhou\", getConfig('sms_appkey'), getConfig('sms_secret'));\n DefaultProfile::addEndpoint(\"cn-hangzhou\", \"cn-hangzhou\", \"Dysmsapi\", \"dysmsapi.aliyuncs.com\");\n $acsClient = new DefaultAcsClient($profile);\n // 初始化SendSmsRequest实例用于设置发送短信的参数\n $request = new SendSmsRequest();\n // 必填,设置短信接收号码\n $request->setPhoneNumbers($phone);\n // 必填,设置签名名称\n $request->setSignName(getConfig('sms_FreeSignName'));\n // 必填,设置模板CODE\n $request->setTemplateCode(getConfig('sms_TemplateCode'));\n\n $code = self::setCode($phone);\n $request->setTemplateParam(\"{\\\"code\\\":\\\"\".$code.\"\\\"}\");\n\n $acsResponse = $acsClient->getAcsResponse($request);\n // 默认返回stdClass,通过返回值的Code属性来判断发送成功与否\n if($acsResponse && strtolower($acsResponse->Code) == 'ok')\n {\n return responseJson(true,'发送成功');\n }\n Log::error('【sms-error】'.$phone.':'.$acsResponse->Code);\n return responseJson(false,$acsResponse->Code,'',422);\n }", "public function send(){\n\t\t$statusStr = array(\n\t\t\"0\" => \"短信发送成功\",\n\t\t\"-1\" => \"参数不全\",\n\t\t\"-2\" => \"服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!\",\n\t\t\"30\" => \"密码错误\",\n\t\t\"40\" => \"账号不存在\",\n\t\t\"41\" => \"余额不足\",\n\t\t\"42\" => \"帐户已过期\",\n\t\t\"43\" => \"IP地址限制\",\n\t\t\"50\" => \"内容含有敏感词\"\n\t\t);\n\t\t$yzm=rand(100000,999999);\n\t\t/* session('sendtime',time());\n\t\tsession('code',$yzm);\n\t\tsession('phonenum',$phone); */\n \n\t\t$smsapi = \"http://api.smsbao.com/\";\n\t\t$user = \"hyl123456789\"; //短信平台帐号\n\t\t$pass = md5(\"hyl123456\"); //短信平台密码\n\t\t$content=\"【易菜篮】您的验证码为:\" . $yzm . \"。5分钟内输入有效。\";//要发送的短信内容\n\t\t$phone = input('param.phone');//\"*****\";//要发送短信的手机号码\n session('code',$yzm); //验证码存入session\n session('phonenum',$phone); //手机号存入session\n session('sendtime',time()); //发送时间存入session\n\t\t$sendurl = $smsapi.\"sms?u=\".$user.\"&p=\".$pass.\"&m=\".$phone.\"&c=\".urlencode($content);\n\t\t$result =file_get_contents($sendurl);\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\tif ($result==0){\n\t\t\t\n\t\t\t$data['status']=1;\n\t\t\t$data['info']=\"验证码发送成功!\";\n\t\t\t$msg=json_encode($data);\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} else {\n\t\t\t$data['status']=0;\n\t\t\t$data['info']=\"验证码发送失败\";\n\t\t\t$msg=json_encode($data);\n\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} \n\t\t//echo $statusStr[$result];\n\t}", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function statement($details,$phone){\n\t$ussd_text=\"CON <br/> Enter your PIN\"; \n ussd_proceed($ussd_text); \n}", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "private function returnCodeMessage(int $code): string {\n $codes = [\n 211 => 'System status, or system help reply',\n 214 => 'Help message (A response to the HELP command)',\n 220 => '<domain> Service ready',\n 221 => '<domain> Service closing transmission channel',\n 235 => 'Authentication succeeded',\n 250 => 'Requested mail action okay, completed',\n 251 => 'User not local; will forward',\n 252 => 'Cannot verify the user, but it will try to deliver the message anyway',\n 334 => '(Server challenge - the text part contains the Base64-encoded challenge)',\n 354 => 'Start mail input',\n 421 => 'Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)',\n 432 => 'A password transition is needed',\n 450 => 'Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)',\n 451 => 'Requested action aborted: local error in processing / IMAP server unavailable',\n 452 => 'Requested action not taken: insufficient system storage',\n 454 => 'Temporary authentication failure',\n 455 => 'Server unable to accommodate parameters',\n 500 => 'Syntax error, command unrecognized (This may include errors such as command line too long) / Authentication Exchange line is too long',\n 501 => 'Syntax error in parameters or arguments / Cannot Base64-decode Client responses / Client initiated Authentication Exchange (only when the SASL mechanism specified that client does not begin the authentication exchange)',\n 502 => 'Command not implemented',\n 503 => 'Bad sequence of commands',\n 504 => 'Command parameter is not implemented / Unrecognized authentication type',\n 521 => 'Server does not accept mail',\n 523 => 'Encryption Needed',\n 530 => 'Authentication required',\n 534 => 'Authentication mechanism is too weak',\n 535 => 'Authentication credentials invalid',\n 538 => 'Encryption required for requested authentication mechanism',\n 550 => 'Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)',\n 551 => 'User not local; please try <forward-path>',\n 552 => 'Requested mail action aborted: exceeded storage allocation',\n 553 => 'Requested action not taken: mailbox name not allowed',\n 554 => 'Transaction has failed (Or, in the case of a connection-opening response, \"No SMTP service here\") / Message too big for system',\n 556 => 'Domain does not accept mail',\n ];\n return $codes[$code] ?? '';\n }", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "private function processCurlCommand($code)\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"https://connect.stripe.com/oauth/token\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, \"client_secret=\" .\\Config::STRIPE_SECRET . \"&code=$code&grant_type=authorization_code\");\n curl_setopt($ch, CURLOPT_POST, 1);\n $headers = array();\n $headers[] = \"Content-Type: application/x-www-form-urlencoded\";\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n $result = curl_exec($ch);\n if (curl_errno($ch)) {\n echo 'Error:' . curl_error($ch);\n }\n\n $obj = json_decode($result,true);\n return $obj['stripe_user_id'];\n }", "public function send(string $code, Authenticatable $user);", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function passwordResetCode();", "function requestCode ($domain) {\n $url = 'https://' . $domain . '/oauth/authorize/' .\n '?client_id=' . urlencode(APP_ID);\n redirect($url);\n}", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function verify_telephone()\n\t{\n\t\tlog_message('debug', 'Account/verify_telephone');\n\t\t$data = filter_forwarded_data($this);\n\t\tlog_message('debug', 'Account/verify_telephone:: [1] post='.json_encode($_POST));\n\n\t\tif(!empty($_POST)){\n\t\t\t$result = FALSE;\n\t\t\t$data['msg'] = '';\n\t\t\t$data['hasPosted'] = 'Y';\n\n\t\t\t# a) Is user updating their phone details?\n\t\t\tif(!empty($_POST['telephone'])){\n\t\t\t\t# Add or update phone and send verification code\n\t\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t\t# Update the user telephone and provider if sucessful\n\t\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t\t$data['msg'] .= $this->native_session->get('__telephone') != $_POST['telephone']? 'Your phone number has been updated and a': 'A';\n\t\t\t\t\t$data['msg'] .= ' code has been sent for verification';\n\t\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t\t$result = TRUE;\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t\telse $data['msg'] .= 'ERROR: Your phone number could not be updated or code sent.';\n\t\t\t}\n\n\t\t\t# b) Verify telephone code\n\t\t\telse if(!empty($_POST['usercode'])){\n\t\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'baseLink'=>base_url()\n\t\t\t\t));\n\n\t\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$data['area'] = !empty($data['area'])? $data['area']: 'user_phone_details';\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "function rest_authorization_required_code()\n {\n }", "public function test_auth_code_redemption() {\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}" ]
[ "0.689822", "0.6738459", "0.66279936", "0.64241266", "0.6382327", "0.63817763", "0.63147527", "0.60499066", "0.5902512", "0.587917", "0.58738446", "0.58483106", "0.5804973", "0.57992697", "0.57807124", "0.57551396", "0.57377243", "0.57367593", "0.57090575", "0.5672435", "0.56141", "0.5531213", "0.5509516", "0.5496162", "0.54908365", "0.547364", "0.5464189", "0.54409295", "0.5439215", "0.54201126" ]
0.69796145
0
/desc:verify email /input:arg(authcode) /output:return(user_id,email,code_type,errorcode(1success,0failed))
function verify_authcode_email($authcode) { $user_id=$email=$code_type=$user_type=0; if($this->_redis) { $data=$this->cache->get($authcode); if(!empty($data)) { $data=json_decode($data); $user_id=$data->user_id; $email=$data->email; $code_type=$data->code_type; $user_type=$data->user_type; $this->cache->delete($authcode); $errorcode=true; } else { $errorcode=false; log_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode)); } } else { $this->db->select("id,user_id,email,code_type,user_type,generate_time"); $this->db->from($this->_table); $this->db->where("authcode",$authcode); $this->db->where("has_verified",0); $this->db->where("type",Constant::VERIFY_TYPE_EMAIL); $query=$this->db->get(); $total=$query->num_rows(); $gen_time=$query->row()->generate_time; if($total==1&&date("Y-m-d H:i:s",strtotime($gen_time." + ".Constant::AUTHCODE_EXPIRE_EMAIL))>date("Y-m-d H:i:s")) { $id=$query->row()->id; $user_id=$query->row()->user_id; $email=$query->row()->email; $code_type=$query->row()->code_type; $user_type=$query->row()->user_type; $this->db->where('id',$id); $this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date("Y-m-d H:i:s"))); if($this->db->affected_rows()==1) $errorcode=true; else $errorcode=false; } else { $errorcode=false; } } return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "public function verify_get($email=null,$verification_code=null){\n\n\t\tif(!empty($verification_code) && !empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$verification_code)->update('users',array('verified'=>1));\n\t\t\tif($this->db->affected_rows()>0){\n\t\t\t\t$this->response(['Verified'], REST_Controller::HTTP_OK);\n\n\t\t\t}else{\n\t\t\t\t$this->response(['Wrong Code.'], '500');\n\t\t\t}\n\t\t}\n\n\t}", "public function check_verify_get($email){\n\t\tif(!empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verified',1)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Verified.'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Not Verified.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function verifyAccount(){\n\t\t$sql = \"SELECT UID, UName, email from user WHERE ver_code = :ver AND SHA1(email) = :email AND verified = 0\";\n\n\n\t\tif($stmt = $this->_db->prepare($sql)){\n\t\t\t$stmt->bindParam(':ver', $_GET['v'], PDO::PARAM_STR);\n\t\t\t$stmt ->bindParam(':email', $_GET['e'], PDO::PARAM_STR);\n\t\t\t$stmt->execute();\n\n\n\t\t\t$row = $stmt->fetch();\n\n\t\t\tif(isset($row['email'])){\n\t\t\t\t$_SESSION['UID'] = $row['UID'];\n $_SESSION['UNAME'] = $row['UName'];\n\t\t\t\t$_SESSION['LoggedIn'] = 1;\n\t\t\t\t$_SESSION['ISADMIN'] = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn array(4, \"<h2>Verification error. This account has already been verified.</h2>\");\n\t\t\t}\n\t\t\t$stmt->closeCursor();\n\n\t\t\treturn array(0, null);\n\t\t}\n\t\telse{\n\t\t\treturn array(2, \"Database error\");\n\t\t}\n\t}", "public function verifyAction()\n {\n $email = Request::post('email', Filter::FILTER_EMAIL, false);\n\n if (!$email || !Validator_Email::validate($email)) {\n Response::jsonError($this->moduleLang->get('email_invalid'));\n }\n\n $model = Model::factory('User');\n\n $userIds = $model->getList(\n ['limit' => 1],\n [\n 'email' => $email,\n 'enabled'=> true\n ],\n ['id']\n );\n\n if (count($userIds) == 0) {\n Response::jsonError($this->moduleLang->get('email_user_unknown'));\n }\n\n $userId = $userIds[0]['id'];\n\n $user = Db_Object::factory('User', $userId);\n $authCode = Utils::hash(uniqid(time(),true));\n\n $confDate = new DateTime('now');\n $confDate = $confDate->add(new DateInterval('P1D'))->format('Y-m-d H:i:s');\n\n try{\n $user->setValues(array(\n 'confirmation_code' => $authCode,\n 'confirmation_expiried' => $confDate\n ));\n if(!$user->save())\n throw new Exception('Cannot update user info');\n }catch (Exception $e){\n Response::jsonError($this->_lang->get('CANT_EXEC'));\n }\n\n $this->sendEmail($user);\n\n Response::jsonSuccess(array(\n 'msg' => $this->moduleLang->get('pwd_success')\n ));\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function verifica_email ($email)\r\n{\r\n\t$retorno = true;\r\n\r\n\t/* Aqui estaria el codigo para verificar \r\n\tla direccion de correo */\r\n\r\n\treturn $retorno;\r\n}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "function register_resend_email($email) {\n\t\tglobal $pdo;\n\n\t\t//delete old registration attempts\n\t\t$pdo->query(\"DELETE FROM user WHERE verified = 0 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) > 600\");\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if email exists and is not verified\n\t\t$sql = \"SELECT name, verification_code FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 0\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\t//check if email exists but is already verified\n\t\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t\t$sth2 = $pdo->prepare($sql);\n\t\t\t$sth2->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t\t$sth2->execute();\n\n\t\t\tif($sth2->rowCount() == 0) {\n\t\t\t\treturn 2;\n\t\t\t} else {\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\n\t\t//get data required for email\n\t\t$name_verification_code = $sth->fetch();\n\t\t$name = $name_verification_code[\"name\"];\n\t\t$verification_code = $name_verification_code[\"verification_code\"];\n\n\t\t$reg_link = \"https://swapitg.com/firstlogin/$verification_code\";\n\t\t$subject = \"Registration\";\n\t\t$mailfile = fopen(__DIR__ . \"/register_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/register_mail_template.html\")), array('$reg_link' => $reg_link, '$name' => htmlspecialchars($name)));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 4;\n\t\t}\n\t}", "public function test_auth_code_redemption_with_email() {\n\t\tstatic::$test_auth_code['scope'] = 'profile email';\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t\t'profile' => indieauth_get_user( static::$author_id, true )\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t\t// Reset Just in Case.\n\t\tunset( static::$test_auth_code['scope'] );\n\t}", "public function verifyAccount($code) {\n try {\n return $this->getEmailVerificationUtils()->processEmailVerificationRequest($code);\n } catch (\\Illuminate\\Database\\QueryException $ex) {\n return $this->getExceptionUtils()->storeException($ex);\n } catch (\\Exception $ex) {\n return $this->getExceptionUtils()->storeException($ex);\n }\n }", "function checkbemail_post(){\n \n $parameter = array('bemail' => $this->post('bemail') , 'bseq' => '', 'act_mode' => 'emailcheck');\n $data = $this->supper_admin->call_procedureRow('proc_checkbemail', $parameter);\n if(!empty($data)){\n $data = $this->send_json($data); \n $this->response($data, 200); // 200 being the HTTP response code\n }\n else{\n $this->response(array('error' => 'User could not be found'), 404);\n }\n\n }", "function verify_email()\n\t{\n\t\tlog_message('debug', 'Account/verify_email');\n\t\t$data = filter_forwarded_data($this);\n\t\t$data['msg'] = get_session_msg($this);\n\t\tlog_message('debug', 'Account/verify_email:: [1] post='.json_encode($_POST));\n\t\t# skip this step if the user has already verified their email address\n\t\tif($this->native_session->get('__email_verified') && $this->native_session->get('__email_verified') == 'Y'){\n\t\t\tredirect(base_url().'account/login');\n\t\t}\n\n\t\t# otherwise continue here\n\t\tif(!empty($_POST['emailaddress'])){\n\t\t\t$response = $this->_api->post('account/resend_link', array(\n\t\t\t\t'emailAddress'=>$this->native_session->get('__email_address'),\n\t\t\t\t'baseLink'=>base_url()\n\t\t\t));\n\n\t\t\t$data['msg'] = (!empty($response['result']) && $response['result']=='SUCCESS')?'The verification link has been resent':'ERROR: The verification link could not be resent';\n\t\t}\n\n\t\t$data = load_page_labels('sign_up',$data);\n\t\t$this->load->view('account/verify_email', $data);\n\t}", "protected function validateEmail($args) {\n\n if ($args['ent_email'] == '')\n return $this->_getStatusMessage(1, 1);\n\n $vmail = new verifyEmail();\n\n if ($vmail->check($args['ent_email'])) {\n return $this->_getStatusMessage(34, $args['ent_email']);\n } else if ($vmail->isValid($args['ent_email'])) {\n return $this->_getStatusMessage(24, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n//echo 'email valid, but not exist!';\n } else {\n return $this->_getStatusMessage(25, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n//echo 'email not valid and not exist!';\n }\n }", "public function emailCheck($emailid){\n\t\n\t\t$passArray = array();\n\t\t$mod = new userModel();\n\t\t$email = $emailid;\n\t\t$res = $mod->emailCheck($email);\n\t\t\n\t\tif(mysql_num_rows($res) > 0){\n\t\t\t$passArray[] = array();\n\t\t\t$status = FAIL;\n\t\t\t$message = EMAILMESSAGE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$status =SUCCESS;\n\t\t\t$message = ERROREMAIL;\n\t\t}\n\t\t\n\t\t$response = array(\n\t\t\t\t\t\t\t\"Status\" => $status,\n\t\t\t\t\t\t\t\"Message\"=> $message,\n\t\t\t\t\t\t\t\"Result\"=>$passArray\n\t\t\t\t\t\t);\n\t\t\n\t\treturn $response;\n\t}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "function verifyEmail_post(){\n\n\t\t$this->load->library('form_validation');\n\t\t$this->form_validation->set_rules('email',lang('email_placeholder'),'required|valid_email');\n\n\t\tif($this->form_validation->run() == FALSE){\n\n\t\t\t$responseArray = array('status'=>FAIL,'message'=>strip_tags(validation_errors()));\n\t\t\t$response = $this->generate_response($responseArray);\n\t\t\t$this->response($response);\n\n\t\t} else {\n\n\t\t\t$conform = (rand(10, 99)).(rand(11, 99));\n\n\t\t\t$data_val['email']\t\t=\t$this->post('email');\n\t\t\t$data_val['code']\t\t=\t$conform;\n\t\t\t\n\t\t\t$existContact = $this->common_model->get_records_by_id(USERS,true,array('email'=>$data_val['email'],'emailVerified'=>'1'),\"*\",\"\",\"\");\n\t\t\t\n\t\t\tif(empty($existContact)){\n\n\t\t\t\t$isVerify = $this->service_model->verifyEmail($data_val);\n\n\t\t\t\tif(is_array($isVerify)){\n\n\t\t\t\t\tswitch ($isVerify['status']) {\n\n\t\t\t\t\t\tcase \"1\":\n\t\t\t\t\t\t\t$responseArray = array('status'=>SUCCESS,'message'=>ResponseMessages::getStatusCodeMessage(124),'code'=>$isVerify['code'],'email'=>$isVerify['email']);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>$isVerify['error']);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>ResponseMessages::getStatusCodeMessage(118));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else{\n\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>ResponseMessages::getStatusCodeMessage(117));\n\t\t\t}\n\t\t\t$response = $this->generate_response($responseArray);\n\t\t\t$this->response($response);\t\n\t\t}\n\n\t}", "public function email_exists_check ( $email )\n\t{\n\t\t//-----------------------------------------\n\t\t// Get product ID and code from Registry\n\t\t//-----------------------------------------\n\n\t\t$converge = $this->Registry->Cache->cache__do_get( \"converge\" );\n\n\t\tif ( ! $converge['converge_api_code'] )\n\t\t{\n\t\t\t$this->return_code = 'WRONG_AUTH';\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//--------------------------------\n\t\t// Auth against converge...\n\t\t//--------------------------------\n\n\t\tif ( ! is_object( $this->api_server ) )\n\t\t{\n\t\t\trequire_once( PATH_SOURCES . \"api_server.php\" );\n\t\t\t$this->api_server = new API_Server();\n\t\t}\n\n\t\t$request = array(\n\t\t\t\t'auth_key' => $converge['converge_api_code'],\n\t\t\t\t'product_id' => $converge['converge_product_id'],\n\t\t\t\t'email_address' => $email,\n\t\t\t);\n\n\t\t$url = $converge['converge_url'] . '/converge_master/converge_server.php';\n\n\t\t//------------------\n\t\t// Send request\n\t\t//------------------\n\n\t\t$this->api_server->auth_user = $converge['converge_http_user'];\n\t\t$this->api_server->auth_pass = $converge['converge_http_pass'];\n\n\t\t$this->api_server->api_send_request( $url, 'convergeCheckEmail', $request );\n\n\t\t//----------------------\n\t\t// Handle errors...\n\t\t//----------------------\n\n\t\tif ( count( $this->api_server->errors ) )\n\t\t{\n\t\t\t$this->return_code = 'WRONG_AUTH';\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$this->return_code = $this->api_server->params['response'];\n\t\treturn TRUE;\n\t}", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "public function verify_email(){\n // user user-id from session\n $encodedkey = $this->session->userdata('PariKey_session');\n $user_id='';\n $key=base64_decode($encodedkey);\n $keyarr=explode('|', $key);\n\n extract($_POST);\n $response='';\n // print_r($_POST);die();\n\n // validations\n if($entity!=$keyarr[1]){\n $response=array(\n 'status' => 'error',\n 'message' => '<b>Warning:</b> Verification email not matching with Registered email. Please logout your session and log in again!'\n );\n echo json_encode($response);\n die();\n }\n $result = $this->user_model->generate_email_verify_code($entity,$keyarr[2]);\n // print_r($result);die();\n\n if(!$result){\n $response=array(\n 'status' => 'error',\n 'message' => '<b>Error:</b> Perhaps you didn\\'t make any change. Password was not changed!'\n );\n }\n else{\n $verify_code=$result['verify_code'];\n\n // send verificatin code to user email\n $config = Array(\n 'protocol' => 'smtp',\n 'smtp_host' => 'mx1.hostinger.in',\n 'smtp_port' => '587',\n 'smtp_user' => '[email protected]', // change it to yours\n 'smtp_pass' => 'Descartes@1990', // change it to yours\n 'mailtype' => 'html',\n 'charset' => 'utf-8',\n 'wordwrap' => TRUE\n );\n // $config['smtp_crypto'] = 'tls';\n\n $this->load->library('email', $config);\n $this->email->set_newline(\"\\r\\n\");\n $this->email->from('[email protected]', \"Admin Team\");\n $this->email->to($entity);\n $this->email->subject(\"Email Verification: Buddhist Parinay\");\n $this->email->message('<html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n </head>\n <body>\n <div class=\"container col-lg-8\" style=\"box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)!important;margin:10px; font-family:Candara;\">\n <h2 style=\"text-align:center\">Verify your Email</h3>\n <h3 style=\"font-size:15px;\">Hello '.$entity.',<br></h3>\n <h3 style=\"font-size:15px;\">Welcome to Buddhist Parinay. Please <a href=\"'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated\">Click here</a> to verify your Email-Id OR Copy-Paste below link :<br>\n <a href=\"'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated\">'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated</a>\n </h3><br>\n <h3 style=\"font-size:15px;\">Regards,</h3>\n <h3 style=\"font-size:15px;\">Buddhist Parinay Admin,</h3>\n <div class=\"col-lg-12\">\n <div class=\"col-lg-4\"></div>\n <div class=\"col-lg-4\">\n\n </div>\n </body></html>');\n\n if ($this->email->send()) {\n $response=array(\n 'status' => 'success',\n 'message' => '<b>Success:</b> Verification code has been sent to your Registered Email ID.'\n );\n } \n else{\n print_r($this->email->print_debugger());\n }\n }\n echo json_encode($response);\n die();\n}", "function verify_user_and_update_subscription($user_email, $verification_code, $mysqli)\n{\n $subscribed = 'yes';\n $is_verified = 'yes';\n $response = [\n 'success' => false,\n 'error_message' => '',\n ];\n\n $does_user_exists = does_user_exist($user_email, $mysqli);\n\n if (!$does_user_exists) {\n $response['success'] = false;\n $response['error_message'] = 'user does not exist';\n\n return $response;\n }\n}", "public function verify_email($code) {\n $this->db->select('*');\n $this->db->from('vendors');\n $this->db->join('business_details', 'business_details.business_id = vendors.id');\n $this->db->where('vendors.email_verification_code', $code);\n $query = $this->db->get();\n $query_result = $query->result();\n if (!empty($query_result)) {\n $order_status_update = array(\n 'email_verification_status' => '1'\n );\n\n $this->db->where('email_verification_code', $code);\n $this->db->update('vendors', $order_status_update);\n\n\n $partner_details = array();\n if (count($query_result) == 0) {\n $partner_details = $query_result;\n } else {\n $partner_details = $query_result[0];\n }\n return $partner_details;\n } else {\n return \"not matched\";\n }\n }", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}" ]
[ "0.7357168", "0.72274476", "0.72213393", "0.69830644", "0.69380236", "0.6888172", "0.67501175", "0.6735601", "0.6733808", "0.67028695", "0.66032106", "0.6547012", "0.64602464", "0.6446105", "0.64100087", "0.6404664", "0.63921386", "0.6387383", "0.63602126", "0.6347601", "0.6346381", "0.62714833", "0.62711257", "0.6254057", "0.62463534", "0.62413913", "0.6182826", "0.61683506", "0.61650926", "0.6152499" ]
0.7359493
0
/desc:verify phone /input:arg(authcode,verify(1verified,2not verified)) /output:return(user_id,phone,code_type,errorcode(1success,0failed))
function verify_authcode_phone($authcode,$phone,$verify=true) { $user_id=$code_type=0; if($this->_redis) { $data=$this->cache->get($authcode.'_'.sha1($phone)); if(!empty($data)) { $data=json_decode($data); $user_id=$data->user_id; $code_type=$data->code_type; if($verify) $this->cache->delete($authcode.'_'.sha1($phone)); $errorcode=true; } else { $errorcode=false; log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone)); } } else { $this->db->select("id,user_id,phone,code_type,generate_time"); $this->db->from($this->_table); $this->db->where("authcode",$authcode); //加密手机号码 $e_phone=sha1($phone); $this->db->where("phone",$e_phone); $this->db->where("has_verified",0); $this->db->where("type",Constant::VERIFY_TYPE_PHONE); $query=$this->db->get(); $total=$query->num_rows(); if($total) $gen_time=$query->row()->generate_time; if($total==1&&date("Y-m-d H:i:s",strtotime($gen_time." + ".Constant::AUTHCODE_EXPIRE_PHONE))>date("Y-m-d H:i:s")) { $id=$query->row()->id; $user_id=$query->row()->user_id; //$phone=$query->row()->phone;//电话号码已加密 $code_type=$query->row()->code_type; if($verify) { $this->db->where('id',$id); $this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date("Y-m-d H:i:s"))); if($this->db->affected_rows()==1) $errorcode=true; else $errorcode=false; } else { $errorcode=true; } } else { $errorcode=false; } } return array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function verify_telephone()\n\t{\n\t\tlog_message('debug', 'Account/verify_telephone');\n\t\t$data = filter_forwarded_data($this);\n\t\tlog_message('debug', 'Account/verify_telephone:: [1] post='.json_encode($_POST));\n\n\t\tif(!empty($_POST)){\n\t\t\t$result = FALSE;\n\t\t\t$data['msg'] = '';\n\t\t\t$data['hasPosted'] = 'Y';\n\n\t\t\t# a) Is user updating their phone details?\n\t\t\tif(!empty($_POST['telephone'])){\n\t\t\t\t# Add or update phone and send verification code\n\t\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t\t# Update the user telephone and provider if sucessful\n\t\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t\t$data['msg'] .= $this->native_session->get('__telephone') != $_POST['telephone']? 'Your phone number has been updated and a': 'A';\n\t\t\t\t\t$data['msg'] .= ' code has been sent for verification';\n\t\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t\t$result = TRUE;\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t\telse $data['msg'] .= 'ERROR: Your phone number could not be updated or code sent.';\n\t\t\t}\n\n\t\t\t# b) Verify telephone code\n\t\t\telse if(!empty($_POST['usercode'])){\n\t\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'baseLink'=>base_url()\n\t\t\t\t));\n\n\t\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$data['area'] = !empty($data['area'])? $data['area']: 'user_phone_details';\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "private static function verify() {\r\n\t\t// create code object for the given code we will be verifying\r\n\t\tif (!isset($_SESSION['user'])) {\r\n\t\t\tself::alertMessage('danger', 'Unable to find session user data. Try logging out and logging in again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$userID = $_POST['userID'] = $_SESSION['user']->getUserID();\r\n\t\t$code = new VerificationCode($_POST);\r\n\r\n\t\t// load and validate expected code from database\r\n\t\t$codeInDatabase = VerificationCodesDB::get($userID);\r\n\t\tif (is_null($codeInDatabase)) {\r\n\t\t\tself::alertMessage('danger', 'No active verification code found. Your code may have expired. Click \"Resend Code\" to send a new code to your phone.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// compare given/expected codes\r\n\t\tif ($code->getCode() !== $codeInDatabase->getCode()) {\r\n\t\t\tself::alertMessage('danger', 'The code you entered is incorrect. Please check your code and try again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// verification successful. mark phone number as verified\r\n\t\t$user = UsersDB::getUser($userID);\r\n\t\t$user->setIsPhoneVerified(true);\r\n\t\tUsersDB::edit($user);\r\n\t\t$_SESSION['user'] = $user;\r\n\r\n\t\t// clean up and show dashboard\r\n\t\tVerificationCodesDB::clear($userID);\r\n\t\tDashboardView::show();\r\n\t}", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function verifyNumber($phone_number){\n require 'Config.php';\n\n // Initialize CURL:\n $ch = curl_init('http://apilayer.net/api/validate?access_key='.$numverify_access_key.'&number='.$phone_number.'');\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n // Store the data:\n $json = curl_exec($ch);\n curl_close($ch);\n\n // Decode JSON response:\n $validationResult = json_decode($json, true);\n\n // Access and use your preferred validation result objects\n return $validationResult;\n }", "function verify_mobile_number() {\n\n\t\t//$iAccountNo = safeText('account_no', FALSE, 'get');\n\n\t\t$this->authentication->is_user_logged_in(TRUE, 'user/login');\n\n\t\t$this->mcontents['iAccountNo'] = s('ACCOUNT_NO');\n\n\n\t\t$aWhere = array(\n\t\t\t\t\t\t'status' => $this->aUserStatus['active'],\n\t\t\t\t\t);\n\t\tif( ! $oUser = $this->user_model->getUserBy('account_no', $this->mcontents['iAccountNo'], 'basic', $aWhere) ) {\n\t\t\t/*\n\t\t\tp($this->mcontents['iAccountNo']);\n\t\t\tp($oUser);\n\t\t\texit;\n\t\t\t*/\n\t\t\tsf('error_message', 'You cannot access this section right now');\n\t\t\tredirect('home');\n\t\t}\n\n\n\t\t/* Temporary set up to skip mobile number verification step */\n\t\t\t$bSkipMobileNumberVerification = FALSE;\n\n\t\t\tif($bSkipMobileNumberVerification) {\n\t\t\t\t$this->user_model->skipMobileNumberVerification($oUser->account_no);\n\t\t\t}\n\t\t/* Temporary set up to skip mobile number verification step - End */\n\n\n\n\t\t$bIsAccountAwaitingMobileNumVerification = $this->user_model->isAccountAwaitingMobileNumVerification( $oUser->account_no );\n\t\t//$bIsAccountAwaitingMobileNumVerification = TRUE; // to be removed if not useful\n\n\n\t\tif( ! $oUser ) {\n\n\t\t\tsf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('home');\n\t\t}\n\t\tif( ! $bIsAccountAwaitingMobileNumVerification ) {\n\n\t\t\t//sf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('user/manage_mobile_number');\n\t\t}\n\n\n\n\t\tif( isset($_POST) && !empty($_POST) ) {\n\n\t\t\t$this->form_validation->set_rules('verification_code', 'Verification code', 'trim|required');\n\n\t\t\tif ($this->form_validation->run() == TRUE) {\n\n\t\t\t\t$sToken = safeText('verification_code');\n\n\t\t\t\t$aTokenResult = $this->common_model->isValidToken_new($sToken, 'mobile_number_verification', $oUser->account_no);\n\n\t\t\t\t$aTokenStatus = c('token_status');\n\n\t\t\t\tif( $aTokenResult['status'] != $aTokenStatus['valid'] ) {\n\n\t\t\t\t\t//find the reason why this token is not valid\n\t\t\t\t\tif( $aTokenResult['status'] == $aTokenStatus['invalid'] ) {\n\n\t\t\t\t\t\t$iAttempts = 0;\n\t\t\t\t\t\t$iMaxAttempts = 3;\n\n\t\t\t\t\t\tif($iAttempts >= $iMaxAttempts) {\n\n\t\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$this->merror['error'][] = 'the code entered is invalid code.';\n\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t} elseif($aTokenResult['status'] == $aTokenStatus['expired']) {\n\n\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\tsf('error_message', 'The token you entered has expired.');\n\t\t\t\t\t\tredirect('user/verify_mobile_number');\n\t\t\t\t\t}\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\n\t\t\t\t\t$aUserMobileVerificationStatus = $this->config->item('user_mobile_verification_status');\n\n\t\t\t\t\t// set the mobile number as verified\n\t\t\t\t\t$this->db->set('mobile_verification_status', $aUserMobileVerificationStatus['sms_verified']);\n\t\t\t\t\t$this->db->where('account_no', $oUser->account_no);\n\t\t\t\t\t$this->db->update('users');\n\n\t\t\t\t\tsf('success_message', 'Your mobile number has been verified');\n\n\t\t\t\t\t// do the initial setup routines check to see if the user passes it.\n\t\t\t\t\t$this->user_model->initialSetupRoutines($oUser->account_no);\n\n\t\t\t\t\tredirect('profile/edit');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tloadTemplate('user/verify_mobile_number');\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "public function hasVerifiedPhone();", "public function phoneVerify(Request $req) {\n\n $param = $this->createRand(4);\n $url = \"https://open.ucpaas.com/ol/sms/sendsms\";\n $body_json = array(\n \"sid\" => \"1cea456798e180e58fe1e96e9ef9a1e2\",\n \"token\" => \"2fe296ae9fb014aa261b93652375ad0b\",\n \"appid\" => \"c3f231b11343405bb2a8956b2609205f\",\n \"templateid\" => \"430629\",\n \"param\" => $param,\n \"mobile\" => $req->get('mobile')\n );\n $body = json_encode($body_json);\n $data = $this->getResult($url, $body,'post');\n //return $data;\n $obj = json_decode($data);\n if ($obj->code == \"000000\"){\n return $param;\n }\n return \"0000\";\n }", "public function verify_phone_number()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$verification_code = Input::get('verificationCode');\n\n\t\tif ($this->notifyRepo->smsVerificationCheck($user_id, $verification_code))\n\t\t{\n\t\t\t$this->notifyRepo->smsSaveVerifiedPhoneNumber($user_id);\n\t\t\t$this->notifyRepo->smsDeleteVerifyRecord($user_id);\n\t\t\t$valid = [\n\t\t\t\t'status' => true,\n\t\t\t\t'message' => 'Your phone number has been verified.'\n\t\t\t];\n\t\t\treturn $valid;\n\t\t}\n\n\t\t$valid = [\n\t\t\t'status' => false,\n\t\t\t'message' => 'The code you entered does not match the code we sent you.'\n\t\t];\n\t\treturn $valid;\n\t}", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "public function send_verify_code_to_phone(Request $request)\n {\n $phone = $request->input('phone_number');\n $code = $this->generate_verify_code();\n //todo: save verify code to this wxuser\n\n $wxuser_id = session('wechat_user_id');\n $wxuser = WechatUser::find($wxuser_id);\n $wxuser->phone_verify_code = $code;\n $wxuser->save();\n\n return response()->json(['status' => 'success']);\n\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "static function checkMobileVerify($username, $password = null, $code = null)\r\n\t{\r\n\t\t$username = funcs::check_input($username);\r\n\r\n\t\tif($password != null && $code != null)\r\n\t\t{\r\n\t\t\t$password = funcs::check_input($password);\r\n\t\t\t$code = funcs::check_input($code);\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno\r\n\t\t\t\t\t\t\t\t\t\t\t FROM \".TABLE_MEMBER.\"\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_PASSWORD.\"='\".$password.\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_VALIDATION.\"='\".$code.\"' \");\r\n\t\t}\r\n\t\telse\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno FROM \".TABLE_MEMBER.\" WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\");\r\n\r\n\t\treturn $no;\r\n\t}", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "public function sendPhoneVerificationNotification();", "function check_verify($code, $id = ''){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "function is_phone_stored($phoneNumber){\n $data = array(\"phone\"=>$phoneNumber);\n $status = CallAPI(\"ussd.myfarmnow.com/api/verifyphone\", $data);\n if($status == 1){\n return true;\n }elseif($status == 0){\n return false;\n }\n}", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function verifyOTP(){\n\t \t\tif($this->session->userdata('otp')==$this->input->post('otp_')){\n\t \t\t\tif($this->verifyThisUser($this->input->post('mobile_no'))){\n\t \t\t\t\tdie(json_encode(array('code'=>1,'msg'=>\"Registered Successfully.\")));\n\t \t\t\t}else{\n\t \t\t\t\tdie(json_encode(array('code'=>23,'msg'=>\"Failed To Verify.\")));\n\t \t\t\t}\n\t \t\t\t\n\t \t\t}else{\n\t \t\t\tdie(json_encode(array('code'=>0,'msg'=>\"Failed to register\")));\n\t \t\t}\n\t \t}", "public function verify()\n {\n $phone = $this->input->get('phone');\n $token = $this->input->get('token');\n\n if ($phone != $this->session->userdata('phone')) {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n } else {\n $user = $this->m_visitor->get_user('sms_verify', 'phone', $phone);\n if ($user) {\n $token_ = $this->m_visitor->get_user('sms_verify', 'token', $token);\n if ($token_) {\n $data = [\n 'phone' => $phone,\n 'public_space_id' => $this->session->userdata('public_space_id')\n ];\n\n $this->m_visitor->insert('record', $data);\n $this->m_visitor->delete('sms_verify', 'phone', $phone);\n\n $this->session->set_userdata('status', 'in');\n\n $this->session->set_flashdata('message', 'checkin-success');\n redirect('visitor');\n } else {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n }\n } else {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n }\n }\n }", "public function verify_get($email=null,$verification_code=null){\n\n\t\tif(!empty($verification_code) && !empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$verification_code)->update('users',array('verified'=>1));\n\t\t\tif($this->db->affected_rows()>0){\n\t\t\t\t$this->response(['Verified'], REST_Controller::HTTP_OK);\n\n\t\t\t}else{\n\t\t\t\t$this->response(['Wrong Code.'], '500');\n\t\t\t}\n\t\t}\n\n\t}", "public function markPhoneAsVerified();", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function getTwoStepVerificationCode();", "function check_verify($code, $id = 1){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}" ]
[ "0.7081012", "0.7042071", "0.69467556", "0.69088787", "0.6656038", "0.6648316", "0.6640863", "0.66265166", "0.6513513", "0.6507705", "0.6505614", "0.6425127", "0.638509", "0.6370607", "0.6327103", "0.63181174", "0.62563235", "0.62260467", "0.6206373", "0.61765593", "0.6142251", "0.6080398", "0.60555094", "0.60375506", "0.60273576", "0.6026349", "0.60093325", "0.60078883", "0.6002672", "0.6002478" ]
0.7232017
0
Get an array of possible view files.
protected function getPossibleViewFiles($name) { $user_id = Auth::user()->id ?? 0; //var_dump($user_id); return array_map(function ($extension) use ($name, $user_id) { return str_replace('.', '/', $name) . '.' . $extension; $segments = explode(".", $name); if (strstr($extension, 'blade.php') && count($segments) > 1 && $user_id > 0) { //entity_type/user_role/node_type/node_id/viewtype 比如 /waybill/admin/company/1/card //todo 应该获取指定的用户对应的角色和对应的各个节点类型节点编号对应的视图,并且在该方法内通过循环确定正确的视图文件名 $entity_type = $segments[0]; $view_type = $segments[1]; $user_role = 1; $node_type = 10; $node_id = 1; $name = "$entity_type.$user_role.$node_type.$node_id.$view_type"; } $filename = str_replace('.', '/', $name) . '.' . $extension; return $filename; }, $this->extensions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function availableViews() {\n\tglobal $fmdb, $__FM_CONFIG;\n\t\n\t$array[0][] = __('All Views');\n\t$array[0][] = '0';\n\t\n\t$j = 0;\n\t/** Views */\n\t$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'views', 'view_name', 'view_');\n\tif ($fmdb->num_rows) {\n\t\t$results = $fmdb->last_result;\n\t\tfor ($i=0; $i<$fmdb->num_rows; $i++) {\n\t\t\t$array[$j+1][] = $results[$i]->view_name;\n\t\t\t$array[$j+1][] = $results[$i]->view_id;\n\t\t\t$j++;\n\t\t}\n\t}\n\t\n\treturn $array;\n}", "public function getViews(){\n\n if($this->safe($this->views)){\n //extract vlozi obsah z promenne do pohledu\n extract($this->data);\n extract($this->data, EXTR_PREFIX_ALL, \"\");\n require \"Views/\" . $this->views . \".phtml\";\n }\n }", "protected function getViewModuleFiles($view)\n {\n $rootPath = resource_path('views/' . str_replace('.', '/', $view));\n\n return [\n $rootPath . '/index',\n $rootPath . '/show',\n $rootPath . '/create',\n $rootPath . '/edit'\n ];\n }", "protected function getTyposcriptViewPaths(): array\n {\n // default views settings because TSFE is null when creating a new dce\n $viewsPaths = [\n 'layoutRootPaths' => [0 => 'EXT:dce/Resources/Private/Layouts/'],\n 'templateRootPaths' => [0 => 'EXT:dce/Resources/Private/Templates/'],\n 'partialRootPaths' => [0 => 'EXT:dce/Resources/Private/Partials/'],\n ];\n\n $pageUid = (isset($GLOBALS['TSFE'])) ? $GLOBALS['TSFE']->id : 1;\n $typoScriptSettings = $this->typoScriptUtility->getTyposcriptSettingsByPageUid($pageUid);\n if (isset($typoScriptSettings['view'])) {\n $viewsPaths = $typoScriptSettings['view'];\n }\n\n return $viewsPaths;\n }", "protected function getAllViews() {\n $views = array();\n $this->getAllViews0($views);\n return $views;\n }", "function get_views( ) {\r\n\t\t/*\r\n\t\t * Find current view\r\n\t\t */\r\n\t\tif ( $this->detached ) {\r\n\t\t\t$current_view = 'detached';\r\n\t\t} elseif ( $this->attached ) {\r\n\t\t\t$current_view = 'attached';\r\n\t\t} elseif ( $this->is_trash ) {\r\n\t\t\t$current_view = 'trash';\r\n\t\t} elseif ( empty( $_REQUEST['post_mime_type'] ) ) {\r\n\t\t\tif ( isset( $_REQUEST['meta_query'] ) ) {\r\n\t\t\t\t$query = json_decode( stripslashes( $_REQUEST['meta_query'] ), true );\r\n\t\t\t\t$current_view = $query['slug'];\r\n\t\t\t} else {\r\n\t\t\t\t$current_view = 'all';\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$current_view = $_REQUEST['post_mime_type'];\r\n\t\t}\r\n\r\n\t\t$mla_types = MLAMime::mla_query_view_items( array( 'orderby' => 'menu_order' ), 0, 0 );\r\n\t\tif ( ! is_array( $mla_types ) ) {\r\n\t\t\t$mla_types = array ();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Filter the list, generate the views\r\n\t\t */\r\n\t\t$view_links = array();\r\n\t\tforeach ( $mla_types as $value ) {\r\n\t\t\tif ( $value->table_view ) {\r\n\t\t\t\tif ( $current_view == $value->specification ) {\r\n\t\t\t\t\t$current_view = $value->slug;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( $link = self::_get_view( $value->slug, $current_view ) ) {\r\n\t\t\t\t\t$view_links[ $value->slug ] = $link;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $view_links;\r\n\t}", "public function getViews();", "public function provideGetViewScript()\n {\n return [\n 'file does not exist' => [\n 'expected' => '',\n 'script' => '',\n 'filepaths' => '',\n 'paths' => [''],\n ],\n\n 'file does exist' => [\n 'expected' => __FILE__,\n 'script' => '',\n 'filepaths' => __FILE__,\n 'paths' => [''],\n ],\n ];\n }", "public function view(): array\n {\n $file = $this->model;\n\n return [\n 'breadcrumb' => function () use ($file): array {\n return $file->panel()->breadcrumb();\n },\n 'component' => 'k-file-view',\n 'props' => $this->props(),\n 'search' => 'files',\n 'title' => $file->filename(),\n ];\n }", "function fake_views_default_views() {\n $views = array();\n $view_files = file_scan_directory(drupal_get_path('module', \n'my_module') . '/views', '.*\\.views\\.inc\\.php');\n foreach ($view_files as $file => $data) {\n include $file;\n $views[$view->name] = $view;\n\n }\n return $views;\n\n}", "private static function get_views_options() {\n\t\t$views = FrmProDisplay::getAll( array(), 'post_title' );\n\t\t$views_options = array_map( 'self::set_view_options', $views );\n\t\t$views_options = array_reverse( $views_options );\n\n\t\treturn $views_options;\n\t}", "function _sebd7tweaks_API_read_views_from_folder($folder) {\n $views = array();\n // Rather than embedding long code from each views, each one have its own file...\n foreach(drupal_system_listing('/\\.inc$/', $folder, 'name', 0) as $file) {\n include $file->uri;\n $views[$view->name] = $view;\n }\n // Return the generated views array\n return $views;\n}", "protected function getFilesToProcess()\n {\n return array(\n 'custom/modules/Quotes/metadata/detailviewdefs.php',\n );\n }", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/idolisr.php',\n 'sources_custom/hooks/modules/members/idolisr.php',\n 'sources_custom/miniblocks/main_stars.php',\n 'sources_custom/miniblocks/side_recent_points.php',\n 'themes/default/templates_custom/POINTS_GIVE.tpl',\n 'themes/default/templates_custom/BLOCK_MAIN_STARS.tpl',\n 'themes/default/templates_custom/BLOCK_SIDE_RECENT_POINTS.tpl',\n );\n }", "public function getAllViews()\n {\n if (!$this->_area || empty($this->_areViewsCollectedInArea[$this->_area])) {\n $this->collectAllViewsFiles($this->_area);\n }\n return $this->_views;\n }", "function dp_selected_view_types() {\n\t$selected_types = get_option('dp_view_types');\n\tif(empty($selected_types))\n\t\treturn array();\n\n\t$supported_types = dp_supported_view_types();\n\tforeach($selected_types as $key => $value)\n\t\t$selected_types[$key] = $supported_types[$key];\n\n\treturn apply_filters('dp_selected_view_types', $selected_types);\n}", "public function GetViewsDir ();", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/trickstr.php',\n 'sources_custom/programe/.htaccess',\n 'sources_custom/programe/aiml/.htaccess',\n 'sources_custom/programe/aiml/index.html',\n 'sources_custom/programe/index.html',\n 'sources_custom/hooks/modules/chat_bots/knowledge.txt',\n 'sources_custom/hooks/modules/chat_bots/trickstr.php',\n 'sources_custom/programe/aiml/readme.txt',\n 'sources_custom/programe/aiml/startup.xml',\n 'sources_custom/programe/aiml/std-65percent.aiml',\n 'sources_custom/programe/aiml/std-pickup.aiml',\n 'sources_custom/programe/botloaderfuncs.php',\n 'sources_custom/programe/customtags.php',\n 'sources_custom/programe/db.sql',\n 'sources_custom/programe/graphnew.php',\n 'sources_custom/programe/respond.php',\n 'sources_custom/programe/util.php',\n );\n }", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/jestr.php',\n 'sources_custom/forum/cns.php',\n 'lang_custom/EN/jestr.ini',\n 'themes/default/templates_custom/EMOTICON_IMG_CODE_THEMED.tpl',\n 'forum/pages/modules_custom/topicview.php',\n 'sources_custom/hooks/systems/config/jestr_avatar_switch_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_emoticon_magnet_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_leet_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_name_changes.php',\n 'sources_custom/hooks/systems/config/jestr_name_changes_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_piglatin_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_string_changes.php',\n 'sources_custom/hooks/systems/config/jestr_string_changes_shown_for.php',\n );\n }", "function get_views() {\n\t\treturn Array(\n\t\t\t'all' => '<A href = \"/\" class = \"current\">All</a>',\n\t\t\t'approved' => '<a href = \"approved\">Approved</a>',\n\t\t\t'cancelled' => '<a href = \"cancelled\">Cancelled</a>'\n\t\t);\n\t}", "protected function getFiles(): array\n {\n return [];\n }", "public function getRouteFiles(): array;", "function getViewFilePath();", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/google_search.php',\n 'lang_custom/EN/google_search.ini',\n 'sources_custom/blocks/side_google_search.php',\n 'sources_custom/blocks/main_google_results.php',\n 'themes/default/templates_custom/BLOCK_SIDE_GOOGLE_SEARCH.tpl',\n 'themes/default/templates_custom/BLOCK_MAIN_GOOGLE_SEARCH_RESULTS.tpl',\n 'themes/default/css_custom/google_search.css',\n 'pages/comcode_custom/EN/_google_search.txt',\n );\n }", "function turnitintooltwo_get_view_actions() {\n return array('view');\n}", "public function viewProvider()\n {\n $config = $this->getMartyConfig();\n $templateDir = $config['templateDir'];\n $templates = [];\n $it = new \\RecursiveIteratorIterator(new \\RecursiveDirectoryIterator($templateDir));\n /** @var \\SplFileInfo $file */\n foreach ($it as $file) {\n if ($file->isFile() && $file->getExtension() == 'tpl') {\n $templateName = substr($file->getPathname(), strlen($templateDir) + 1);\n $templateId = str_replace(['/', '.tpl'], ['.', ''], $templateName);\n $templates[$templateId] = [$templateName];\n }\n }\n\n return $templates;\n }", "public function getFiles(): array;", "function _generateFilesList() {\n return array();\n }", "protected function getAllViewsNames() {\n $views = Views::getEnabledViews();\n $options = [];\n foreach ($views as $view) {\n $options[$view->get('id')] = $view->get('label');\n }\n return $options;\n }", "public function getDeviceFiles()\n {\n return [$this->getPreferredDeviceFile()];\n }" ]
[ "0.68583673", "0.6747502", "0.6722233", "0.6706559", "0.6586508", "0.6569959", "0.6563175", "0.649346", "0.63854706", "0.63686913", "0.63263506", "0.63124937", "0.6309444", "0.6297853", "0.6285851", "0.6274101", "0.6222237", "0.6213446", "0.61889684", "0.61388683", "0.6132831", "0.61046475", "0.60920876", "0.6072598", "0.6049143", "0.6023067", "0.6020619", "0.60047156", "0.5982434", "0.5974242" ]
0.7155296
0
/ PPBKDF2 A Password KDF called Parallel PBKDF2. Written in 2020 Steve "Sc00bz" Thomas (steve at tobtu dot com) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see < Parallel PBKDF2 (PPBKDF2) A computationally hard password KDF work = xorBlocks(pbkdf2(pw, salt, iterations:1024, length:384hashLencost)) key = pbkdf2(pw, work, iterations:1, length) Note each block of output is calculated independently of each other. This can use SIMD and threads to compute faster.
function ppbkdf2($algo, $password, $salt, $cost, $length = 0, $binary = false) { // Hash length and PHP limits // There is no actual limit to cost. When 384*cost is more than 2^32-1, // iterations is doubled and cost is halved until 384*cost is less than 2^32. $hashLen = strlen(hash_pbkdf2($algo, '', '', 1, 0, true)); if ($cost <= 0 || $cost > 0x7fffffff / 384 / $hashLen) { return false; } // Work $len = 384 * $cost * $hashLen; $hash = hash_pbkdf2($algo, $password, $salt, 1024, $len, true); $work = substr($hash, 0, $hashLen); for ($i = $hashLen; $i < $len; $i += $hashLen) { $work = $work ^ substr($hash, $i, $hashLen); } // KDF $key = hash_pbkdf2($algo, $password, $work, 1, $length, true); if (!$binary) { $key = bin2hex($key); } return $key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)\n{\n $algorithm = strtolower($algorithm);\n if(!in_array($algorithm, hash_algos(), true))\n trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);\n if($count <= 0 || $key_length <= 0)\n trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);\n\n if (function_exists(\"hash_pbkdf2\")) {\n // The output length is in NIBBLES (4-bits) if $raw_output is false!\n if (!$raw_output) {\n $key_length = $key_length * 2;\n }\n return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);\n }\n\n $hash_length = strlen(hash($algorithm, \"\", true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = \"\";\n for($i = 1; $i <= $block_count; $i++) {\n // $i encoded as 4 bytes, big endian.\n $last = $salt . pack(\"N\", $i);// $i encoded as 4 bytes, big endian.\n // first iteration\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n // perform the other $count - 1 iterations\n for ($j = 1; $j < $count; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if($raw_output)\n return substr($output, 0, $key_length);\n else\n return bin2hex(substr($output, 0, $key_length));\n}", "private function hashModePbkdf2($password)\n {\n $this->cwsDebug->titleH2('Create password hash using PBKDF2');\n $this->cwsDebug->labelValue('Password', $password);\n\n $salt = $this->random(self::PBKDF2_RANDOM_BYTES);\n $this->cwsDebug->labelValue('Salt', $salt);\n\n $algorithm = $this->encode(self::PBKDF2_ALGORITHM);\n $this->cwsDebug->labelValue('Algorithm', self::PBKDF2_ALGORITHM);\n\n $ite = rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE);\n $this->cwsDebug->labelValue('Iterations', $ite);\n $ite = $this->encode(rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE));\n\n $params = $algorithm.self::PBKDF2_SEPARATOR;\n $params .= $ite.self::PBKDF2_SEPARATOR;\n $params .= $salt.self::PBKDF2_SEPARATOR;\n\n $hash = $this->getPbkdf2($algorithm, $password, $salt, $ite, self::PBKDF2_HASH_BYTES, true);\n $this->cwsDebug->labelValue('Hash', $hash);\n $this->cwsDebug->labelValue('Length', strlen($hash));\n\n $finalHash = $params.base64_encode($hash);\n $this->cwsDebug->dump('Encoded hash (length : '.strlen($finalHash).')', $finalHash);\n\n if (strlen($finalHash) == self::PBKDF2_LENGTH) {\n return $finalHash;\n }\n\n $this->error = 'Cannot generate the PBKDF2 password hash...';\n $this->cwsDebug->error($this->error);\n }", "function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo = 'sha1'): string|false {}", "public static function hash_pbkdf2($password, $salt){\n $algorithm = \"sha256\";\n $count = 1000;\n $key_length = 64;\n $raw_output = false;\n \n if(!in_array($algorithm, hash_algos(), true))\n trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);\n if($count <= 0 || $key_length <= 0)\n trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);\n\n if (function_exists(\"hash_pbkdf2\")) {\n // The output length is in NIBBLES (4-bits) if $raw_output is false!\n if (!$raw_output) {\n $key_length = $key_length * 2;\n }\n return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);\n }\n\n $hash_length = strlen(hash($algorithm, \"\", true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = \"\";\n for($i = 1; $i <= $block_count; $i++) {\n // $i encoded as 4 bytes, big endian.\n $last = $salt . pack(\"N\", $i);\n // first iteration\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n // perform the other $count - 1 iterations\n for ($j = 1; $j < $count; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if($raw_output)\n return substr($output, 0, $key_length);\n else\n return bin2hex(substr($output, 0, $key_length));\n }", "static function pbkdf2($P, $S, $c = 1000, $dkLen = 32, $Hash = 'sha256', $raw_output = false)\r\n {\r\n if(!in_array($Hash, hash_algos(), true)) return False;\r\n if($c <= 0 || $dkLen <= 0) return False;\r\n\r\n $hLen = strlen(hash($Hash, \"\", true));\r\n $l = ceil($dkLen / $hLen);\r\n\r\n $DK = \"\";\r\n // Block Function\r\n for($i = 1; $i <= $l; $i++) {\r\n // Iteration of the Pseudo-Random-Function (PRF) for each Block\r\n $U_j = $T_i = hash_hmac($Hash, $S . pack(\"N\", $i), $P, true);\r\n for ($j = 1; $j < $c; $j++) {\r\n $T_i ^= ($U_j = hash_hmac($Hash, $U_j, $P, true));\r\n }\r\n // Concat Results\r\n $DK .= $T_i;\r\n }\r\n return ($raw_output?substr($DK, 0, $dkLen):bin2hex(substr($DK, 0, $dkLen)));\r\n }", "private function getPbkdf2($algorithm, $password, $salt, $ite, $key_length, $raw_output = false)\n {\n $algorithm = strtolower(self::decode($algorithm));\n if (!in_array($algorithm, hash_algos(), true)) {\n $this->error = 'Invalid hash algorithm for PBKDF2...';\n $this->cwsDebug->error($this->error);\n\n return;\n }\n\n $ite = self::decode($ite);\n if (!is_numeric($ite) || $ite <= 0 || $key_length <= 0) {\n $this->error = 'Invalid parameters for PBKDF2...';\n $this->cwsDebug->error($this->error);\n\n return;\n }\n\n $hash_length = strlen(hash($algorithm, '', true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = '';\n for ($i = 1; $i <= $block_count; $i++) {\n $last = $salt.pack('N', $i);\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n for ($j = 1; $j < $ite; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if ($raw_output) {\n return substr($output, 0, $key_length);\n } else {\n return bin2hex(substr($output, 0, $key_length));\n }\n }", "public function pwgen()\n\t{\n\t\t// $timetarget = 0.05;\n\t\t// $cost = 8;\n\t\t// do {\n\t\t// \t$cost++;\n\t\t// \t$start = microtime(true);\n\t\t// \tpassword_hash(\"testing\", PASSWORD_BCRYPT, ['cost' => $cost]);\n\t\t// \t$end = microtime(true);\n\t\t// \techo \"{$cost}<br><hr>\";\n\t\t// } while (($end - $start) < $timetarget);\n\t\t// selesai mencari $argon2i$v=19$m=1024,t=2,p=2$czZrU3NmSkwyZWFCZzZqcg$4BCXT3Xjj+nwslQZOa8I2rO760hSmVmzCiSQ/8cfcDs\n\n\t\t$a = password_hash('admin', PASSWORD_ARGON2I);\n\t\techo \"{$a}<br>\";\n\t\t$b = password_verify('superadmin', $a);\n\t\techo \"{$b}\";\n\t\tdie();\n\t}", "function password_krypt($pwd) {\n $options = [\n 'cost' => 12,\n ];\n return password_hash($pwd, PASSWORD_BCRYPT, $options);\n}", "public function setPbkdf2Mode()\n {\n $this->setMode(self::MODE_PBKDF2);\n }", "private function passwordKDF($secret, $salt = NULL)\n {\n //check if salt is set as function argument\n if (is_null($salt))\n {\n $salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);\n }\n else {\n $salt = sodium_hex2bin($salt);\n }\n\n $seed = sodium_crypto_pwhash(\n $this->DIGEST_BYTES,\n $secret, //secret/password\n $salt, //salt\n $this->OPS_LIMIT,\n $this->MEM_LIMIT\n );\n return $seed;\n }", "public function getCryptographicKey(\n string $password,\n string $salt = '',\n int $iterations = 1024,\n int $length = 48\n ): string {\n return hash_pbkdf2(\"sha256\", $password, $salt, $iterations, $length);\n }", "private function checkModePbkdf2($password, $hash)\n {\n $this->cwsDebug->titleH2('Check password hash in PBKDF2 mode');\n $this->cwsDebug->labelValue('Password', $password);\n $this->cwsDebug->dump('Hash', $hash);\n\n $params = explode(self::PBKDF2_SEPARATOR, $hash);\n if (count($params) < self::PBKDF2_SECTIONS) {\n return false;\n }\n\n $algorithm = $params[self::PBKDF2_ALGORITHM_INDEX];\n $salt = $params[self::PBKDF2_SALT_INDEX];\n $ite = $params[self::PBKDF2_ITE_INDEX];\n $hash = base64_decode($params[self::PBKDF2_HASH_INDEX]);\n $this->cwsDebug->labelValue('Decoded hash', $hash);\n\n $checkHash = $this->getPbkdf2($algorithm, $password, $salt, $ite, strlen($hash), true);\n $this->cwsDebug->labelValue('Check hash', $checkHash);\n\n $result = $this->slowEquals($hash, $checkHash);\n $this->cwsDebug->labelValue('Valid?', ($result ? 'YES!' : 'NO...'));\n\n return $result;\n }", "function kpk($a,$b){\n\t\treturn ($a / fpb($a,$b)) * $b;\n\t}", "function getSharedKey($a,$B, $p){\n\t\treturn modpow($B,$a,$p);\n\t}", "function pw_hash($password)\n{\n // A higher \"cost\" is more secure but consumes more processing power\n $cost = 10;\n\n // Create a random salt\n $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');\n\n // Prefix information about the hash so PHP knows how to verify it later.\n // \"$2a$\" Means we're using the Blowfish algorithm. The following two digits are the cost parameter.\n $salt = sprintf(\"$2a$%02d$\", $cost) . $salt;\n\n // Hash the password with the salt\n $hashed = crypt($password, $salt);\n\n return $hashed;\n}", "public function SeedDecrypt(\n\t\t\t\t\t$pbData=array(), \t\t\t\t\t// [in] encrypted data\n\t\t\t\t\t$pdwRoundKey=array(), \t\t\t// [in] round keys for decryption\n\t\t\t\t\t&$outData=array()\t\t\t\t\t// [out] data to be encrypted\n\t\t\t\t\t)\n\t{\n\t $L0 = 0x0; $L1 = 0x0; $R0 = 0x0; $R1 = 0x0;\n\t $K=array();\n\t $nCount = 31;\n\n// Set up input values for decryption\n\t $L0 = ($pbData[0]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[1]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[2]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[3]&0x000000ff);\n\n\t $L1 = ($pbData[4]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[5]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[6]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[7]&0x000000ff);\n\n\t $R0 = ($pbData[8]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[9]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[10]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[11]&0x000000ff);\n\n\t $R1 = ($pbData[12]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[13]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[14]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[15]&0x000000ff);\n\n// Reorder for little endian\n\t\tif (!$this->ENDIAN) { $this->EndianChange($L0); $this->EndianChange($L1); $this->EndianChange($R0); $this->EndianChange($R1); }\n\n\t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n \t$this->SeedRound($L0, $L1, $R0, $R1, $K); /* 1 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n \t$this->SeedRound($R0, $R1, $L0, $L1, $K); /* 2 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 3 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 4 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 5 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 6 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 7 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 8 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 9 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 10 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 11 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 12 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 13 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 14 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 15 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 16 */\n\n\t\tif (!$this->ENDIAN) {$this->EndianChange($L0); $this->EndianChange($L1); $this->EndianChange($R0); $this->EndianChange($R1);}\n\n// Copy output values from last round to outData\n\t\tfor ($i=0;$i<16;$i++) $outData[$i] = null;\n \tfor ($i=0; $i<4; $i++)\n \t{\n\t \t$outData[$i] = $this->ConvertByte(($R0>>(8*(3-$i)))&0xff);\n\t \t$outData[4+$i] = $this->ConvertByte(($R1>>(8*(3-$i)))&0xff);\n\t \t$outData[8+$i] = $this->ConvertByte(($L0>>(8*(3-$i)))&0xff);\n\t \t$outData[12+$i] = $this->ConvertByte(($L1>>(8*(3-$i)))&0xff);\n\t }\n \t \treturn $outData;\n\t}", "public function testPKCS8RC2CBC(): void\n {\n\n // EncryptionAlgorithm: id-PBES2\n // EncryptionScheme: rc2CBC\n // PRF: id-hmacWithSHA1\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIFFjBIBgkqhkiG9w0BBQ0wOzAeBgkqhkiG9w0BBQwwEQQI/V5Qw9+hKt4CAggA\nAgEQMBkGCCqGSIb3DQMCMA0CAToECPxrtS4U+IIBBIIEyKQyYpJ8tfWXVvitxaPq\n+gtrVVWd/ukjwZ+jQY3g/ZjZNWQPq5XbuoP5F3u5g4V+RoXzAIkdwyiveEv+XssV\nDJVHfNiL6VcdxhFJ1rmt2uq9vFW/x9UHDqAWsnytn46NFRWUqgKzkYWMDqU71IC/\nwyq7UzjTtqdLzaCxkTWYst1o+Iu7VXapFVcscPYyGshLVyZ0x/etc/09LOC4bIpk\n3Qzf+f+adrNxW0mbD3SyDfVadvS8mApsd7bJR320iEKd4CmW0sNAzKkm2ya2aUIi\nHrk3DEgr4rPmpn3BVfZ6pg+yRu+MOxBhl+8yfA+E8kXfe/F7BiMkJQcJTOfLRLfH\nTXipyb4f8oa+gmwwWK0jfCuxoxiOTA1CBCjZoTvdSuFYVTdblysQO3BivvSQgbmD\noHntb7HEoZ6yB49u/LrrowUQNH+XihBcototyLCmC5K+x8N5cZsp+yaLJekDHlQs\nATVMeKCbPjYaS4g48lDyC1VbtNtJc/zN5gOUB0PM80iB02iZegYyeW5+WWzY+Lgu\nlpWLH7PdpqL5KtoH6SJKD6Szl8dKJLYzpHI2esckpp9YsDtX2z/VkUFKTd0PeeNh\nWefX0q8A47NBeBLFEZqmzPrL6IyaPnnPCUsvqk6MEA1DgsmY3DFd8nEYhzJIAwoy\nRw1mCqwL0uukQPqFGByU9YRHyhJd5aAPyF1xSLfUQUJb9xn+wyN57xoamFePPWMi\nUXdESZWX+rjA0ChfEtL9AzXcfO9PBS1p/2JkVxUt/UPfI9SgQn92kLo0LRi/iRLk\nH4zjnkaDy65ZY15bzyK+EvJ+VZ+P24QI7X12f1m+rkssMekHWHf5/SitUpW26ZFe\nM6vXyz3RlXxow+0WcsPob19n/vbgeJQPTfMY0zPS0iCRIggC/liWMEOzP/R1jCYi\nq8TEaUi1Ztx3Gp4Y8Vcf33a/YsxKoUsQlFFtyE6KE3ZEI03E6cMiX21nWULKrk9l\n+8Tq4T1a8I4goVa+e4CYBYwMAY9fdfUJ/p1EnrG6Ynj06a2Zx0IK/dF5w0b/5TeL\nPMyafb4FHkpkyYYFlktQdKIqGjjtmKUr56/7vumVHUyItf5nSuM8lLps8to2MLkE\nMAolD+X4FIGs/1Z5NlUb5AlNVNRY1c7tf+YSXI21PlkBpaRSAvN9/2fmGnxWSvAa\nBEGR0JA4zMPrCSpxrBQpOrZPh/cD9YXNu+N9P4dtf57smCviKTJg8eMl9NYu4vtc\nFygdqPKuhJM2WI5Qdrqjbf4NQ1mngSxXNKrcNmC/m60JPNKHC7dM2ynbN8QyZqEE\nEzSdL0Z3YQGnuwr+4zKHHsNnO4nRJfUowWks4Gvi2HIyy3DBVqqyEPxDDGEpcqs+\n8GNKTGBg1PCVg+I9Xjxio4tBuwLDo6Y8Ef8SphN/0DC9svaQRfEOY3/9WB+fDnrq\nSUSNZNWetkCd247WHwl+JvJDXCuzGJ2+JG5DXuEdCq2EhEVNUWPuotXTPvI+0wsP\nKq23uvzS53ZArQnxlqgwyXQ06jzc+J4AiNtl3uIw8D6LrRyaDsOsKQCEh7qjkqTc\nkhzefbnNRDL5PIJnTfM7vSQ4nUzdAxs/7YzX6GMx1DaCtBANbUVUoIE+3oKdqpGV\n9AmO2phYWCBefw==\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "protected function _computeEncryptionKey($password = '') {}", "function generate_hash($password, $cost = 12)\n{\n /* To generate the salt, first generate enough random bytes. Because\n * base64 returns one character for each 6 bits, the we should generate\n * at least 22*6/8=16.5 bytes, so we generate 17. Then we get the first\n * 22 base64 characters\n */\n\n $salt = substr(base64_encode(openssl_random_pseudo_bytes(17)), 0, 22);\n\n /* As blowfish takes a salt with the alphabet ./A-Za-z0-9 we have to\n * replace any '+' in the base64 string with '.'. We don't have to do\n * anything about the '=', as this only occurs when the b64 string is\n * padded, which is always after the first 22 characters.\n */\n\n $salt = str_replace(\"+\", \".\", $salt);\n\n /* Next, create a string that will be passed to crypt, containing all\n * of the settings, separated by dollar signs\n */\n\n $param = '$' . implode('$', array(\n \"2y\", // select the most secure version of blowfish (>=PHP 5.3.7)\n str_pad($cost, 2, \"0\", STR_PAD_LEFT), // add the cost in two digits\n $salt, // add the salt\n ));\n\n // now do the actual hashing\n\n return crypt($password, $param);\n}", "public function hash_pword($hashme){\n return password_hash($hashme, PASSWORD_BCRYPT);/* md5(sha1($hashme)) */;\n\n}", "public function testPKCS8AES256CBC(): void\n {\n\n // EncryptionAlgorithm: id-PBES2\n // EncryptionScheme: aes256-CBC-PAD\n // PRF: id-hmacWithSHA256 (default)\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIIU53ox17kUkCAggA\nMAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBATi8ZER9juR41S2c35WXTQBIIE\n0K98r5dQq/OxbwA2CH0ENs9Jw2qjvW0uGkH8DdO8XvCJohMrIU8FABxw/50Af5Ew\nNq4FJIYz90LjZzlI7kf97TDMZKw2K3AleymwmfMcKer5pZ6jqdxLGXFztdj3Fm/S\nP+NcVjEZFSEH1MNDEPhiPSIUAf1yQcLwKAzHH0JTnZBOFSBbGxTZLYfvD2angVNL\nxTivLYJGdr1cUrAuZQcM3JGQEvCA5qAC7oRhdVgGyJrl8xXY3mVlaXMsW8A+Q7xj\nNyH7lJUFEF3YPMbpWr8zblCQYgGByM++yOfYQXno50AgWdYjPO88pPzKcCe4x6WV\nqKlvqTYZqb1HgZurTd3BS/e6GWRgnRt8W87nuNcyJasud92Z0FhSGwIirlE89gUW\nEinbY8m6+sL9VZZ5+t66TROtpj1Ohj8t3W+01oLDCtdSTGwLuq9XUsEyuYZSqUN9\n0F43U8pOykNbChi1S8vfFdwf7U1R+hgoF0MRNDwh3hRfSS0zPUnCGb6hDZrOZB9C\ne3xbfXiujVlfhRc7r2qbZHAwqNLcccC98oLfbEIUdBXn6M7GfFIwiuNiS48rehp0\ndA9+CiWJBq+7b/lRdcgQJxjwUpxtMXr/812Bky4dDoMDs32cmMghH2sgUvht0imy\nZhA3IvSCAV1wVoQLqUuPXLMskcKsNCTbL9AYEpJm612dm43btXec2vtjCc4ajpCg\nwICLE2V1jwzWw0girrT/IMt8QUd3fkJZkEAbmFHwuZptFnreRCidZjfQqYhWfyqJ\nnGW+cc7G1bGwxt32fC5eu23hBTJERmRlvkhC+v2WKhYXcKyOKQn5/I4eaEZauDn3\nwmg3f4h/PPuQgqv/vspOai9a5HhPRNyeIjXsk3hxHepEgV+kVSU50BpchSSzBuhK\n71F3nOMTyJ/XXxaZrLLtpo3CcXmI0/JuNG7pjDS++Vx/BQFs8xxDfxRs0Um7RlT1\npiGZGDn9zHNpbspHkAeoQmlplbmjtCClojhfBj4HbXTtlYmDgwKHul4YIni6kgCr\nG+WduGXLeyxmH976vvJasD4wyttL2CZTHLR7Elp+yl0xjXMlj/iP4WYozJAmGifq\nxjLWMsZ0gaBtAoOFrvcgOueE7+E+NdbIHzU4u5FTbz0DLCvrsZeKwpOPEsMw0LVG\nT6rNsBzMY3XyBtV1FdXwmuOcWha62Ezr/RRrfvRPRImy/xVVKOrOQ/KbyELkjroh\nUAEPs7s+89Ovc7P30IfS0Xzlhz2aSRflZarOIqu1JtjTYZ0XWLTWoQT2fjZdnMDV\nqFrbTPdXezqTAAzk3rnkkghgamTVQ7Y8D+BIGHIc4+oVT2jxzSjBQC7szmudanGQ\nhfGLyO+vwLg4r1lanzSULtqfwTZMarjYGxLqpQp8cIjJfzvLI3psRDFyuWCdIbEs\ny3VKgoNsa+PmyimGSa7x2cw6ayTx9wlOhPzaBwqMhHxr4qJwS2ohDONeRfnPr34+\noVD7mnCBLB14qiZcpQv+qPGvd/Q/tA5SBNbZhPuWtjqvy7/K+1FQX6xvx1kl7p9W\nl0Q99rwqECl8y+CiKEXdItkCTA/vgxblSt465Mbdic7cbcP6wAMSGmpryrmZomm/\nmKVKf5kPx2aR2W2KAcgw3TJIu1QX7N+l3kFrf9Owtz1a\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "public function testPKCS82DES(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd2-KeyTripleDES-CBC\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6jAcBgoqhkiG9w0BDAEEMA4ECGT21lf3Tl4dAgIIAASCBMgJmnyaQktoSk8u\nJyUAaB4ZgGWW22BX1xRA7en0sNj4PhBxj1DEXGKNUBx3k6u6Cd7JUupxGfeag5aw\nfi0bWNgEw7YSITmZKaKO5Ee4shQrEDucaH6KEGYV6YspNys5dD817hmd4Yc31q2e\nIg5k3rIpP72Yy9Si0FXmKDE8/GmCYckdIQVUCGZD9nLugvqEC0adludfMAwzCHUY\n68jeyKiPJGTFSmE0wPD5EaWknn3U0eRcmKwZPtFpWEAEv5GTm1h6Y5q+P2X2Qsia\nNeoa4jjnSEww85zbno/k0KdoRIuSEM8qOHdNuU6XNTCGKxEkgBLkY+vjRjOCi+K4\nfzJSAPxaYATGX+W8EWegz3yhwiFujjDPkO9nfeoyks/saFbP9uT8aesZUn4/rIw0\nKyW7lYW0TUyBxfIXg1DEsKcmSrrb0WrFLN/MnjO8Y1bAY63KgKgpFZk+7H/7eCmD\n2Egj6o2LXTEPkxwYyeR41k64LM5RFF5qs4wS0Gfo1oTc6lSbuZNFHSgsXkb+CXFL\nJZ3CuaYFY5Ldfm+1HsrZ9s3GmNAnog6WABXIcz9aULUyJfLr+oZaQR7TC5KpM5Xy\ndyztlsN43D9UZKdz93zW2V3LxbzbOWTrcd9dB1GwrPvWIy/0/dqFOvpcr9k/4S1T\nAJ6pja4x19EQLj2DUvO7JQEy2Rlam+SI/ARQTc0W0dJ8x7FboHZDxUQCRDih5Qw3\ns/xoGflLUYYtAR5hfgjbWuvG3Told4IYlBn2vvVu7UxXQekUOaZLePqucAP3sTDC\npK7JK+OT223FNU5NieGS4hh+jxZQnLuuyxWQaTCJM9isYPqJYsWT9X+c44ixOgLJ\nunYtg+8Lck3On6wiDUPWTLCGJvjb53NhPSovTjNBW2Q7YszXXjeO5svwwxtKHabx\nvCDsG0zdNdwIgupqynbtcuUhsmIsJKBu5c+9i8P21rNF0DZjOkv8mThRA6YQLce8\nmLTcnpLsvCGNehVEStD6pr+CtGsQEEtH3bPc2ZBrpxtz1EHmrI7H3kX1gjbD7bsT\nXWzaxsId+8pmqnAcMRzU3mRv4Fe+387X2irG4OxR/6cFMk3+yfpKJLSsNh6HAVRX\nxzYwVz2WP7RM0KuLh7auAcI1mHk+0xAvDi7s3ggy3SzLzQq9p+EEFVGVSYuVFLbi\nTtlY6HQ3b1Z6KgntoPj79YuOmri6/8w7nBkKt09faYLUf9wZWHLL9/LjZqoJxPfl\nlX5Ss4+MDV1aG9aJoTT53d8Gn8ApWK+XFToFg2InYZzZqBnKP8DHPG8D2Gh/MZlA\nYt4hPDNLf733zm1zJTWo0TF6+4AwZp7XUKTg+pM1CZJDOTbJlEA+cXY3BxOq10bl\nJPJmV/JFINqSeBLN8V2Ong8Q0Dt4uabSmlOUz19SXpimBrO8ztxaqigMFIKMbLXX\nuIVAoxG7KLPuv44yK3Fjsg6OtwZnrWqea02b1qwFFrIKoqmQ8FNFBMYqcHU2IkSq\ngJqSylfqcre5Y1DOSlcjGa7aP4C8AyB5qOG7LZ/CLAePKqgAHtMd/K40Zgku36Ir\n9OAcUXy/H5PFJIleEyjvLLBE0VWs0TVBXi/FiIqwvAYNOFqXl/gtRcZ0kVex/QeN\nrcONqwmUGJOjrfhUyJA=\n-----END ENCRYPTED PRIVATE KEY-----\n';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "public function testPKCS8RC2(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd128BitRC2-CBC\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6jAcBgoqhkiG9w0BDAEFMA4ECAdC2l5rzAQeAgIIAASCBMjuEQDNkvSX6ylp\nWsgQZUSvPdNpdlG084oLmhTV0z4pZeLB0YCyKCM7GMVQ0tsprRW0ky86ulbY3W5Q\n86WNHXYtVIFXEmIjN1syRG5Pq3RZ4Ba6wf36Gc/1713p6GjcPxLZ+JOw1xBEm1rh\n1nI9b43PzbKmczs+6IvRO5b9MjKNkBeNzH9kh4b3zsEW/IFgYaz8zip/zRu4hCSW\nORhnRYFvbI22E84g4/SB1WS34nR/flyZBXT4P87s7bwXEOsXAGnEeVF38znV3awD\nV8rry2e1drRmlhfNhvDroQrkv7O9X2ee91I9gahPKpXtAlGXBgRb8qjVHeI8Ea3K\nTy2zcWnjdE7/jt6pO07+B+FlHNdKySlFdKTHEmJ1x+O5Ui4JaGjI2UML0yGHoYFU\nwGH/1DYJ4+R9d97BYJ/yp9+JAQAjpG7UUt3jFgNx0CAbP7d438l06z2EE87EqIEa\n3Y0ZG1Q5PWE60hPJsvUELdgzcUiKkVCxhOPhwmbSlQpEYXZRBWv0RAJzey6yPMQ+\nL/TkMDpgTNUk9x+n3ehnRuA/tlthxXN/ViDthPO7ovSVCsKsUq6lXotO+3hHLGs0\nu8ZyVKHNEqGso7PfAFsjcJq2C46mQNME4HPOWm5J+TFf/vvwqdYKCiF3arV0hUtW\nx9lyPR2PvZM1ik9jXi6lc5hPegcwmx9/j5yc4/3rQNiwe4dtUpL5JLKAxecKBLgr\natyVnAs69JYaaUT9aKRDzYzCRjo0jIQ9/lgJl2DqVRF9aYnknrVWRIjyKbfKjw7N\nw0yfXlVRw46YuJ72PSHpr7HcfzL1EWzmKcAEPDH/UCpIaoeNTwxeEQSltOM0D0Su\nZzyAQP8sWSXSwdtD5YD7iiUjDN4UMDuIwAEMLN9231/RjvKuLAys0oNRQfHkkiCo\n9rt/VUP8be98UTyKu7Bx7JUEW6VVnYM+Y274MLQk6TcjZyXgbKwhHFJyAjcBAFQp\n5kkYES0kk+57HeBImcB0a5qBor/uAnlsCV690roUlBtkVhBOkTjVi7w/uZsSjIWr\nMBndNHTFqqnkbm8xOOoSH6vS32c1KE8FrGpmkPGc6wziX9Ja/MkuLDXrBIlnP4Yj\naCf0sVMSR1/LoHIGGaGXmTzs0VTR8Z5EyW5uvvCy6dWCWnTKEWmTTS+zqW1RYVBZ\nn/P2ovj2Kl4rhQuSpfOE9xBFWsgPAD6T2FJzfvu0/D3Sw5pI/RT4NnQ77oJSs+jN\nlV33FeceRoJqjcP6YMAiRX4RmkTeD5Hgy0YRLrfQ4PKwAQG82uIj3yqXWveexwb0\nCpm5XxzgCMWGBRvIvM+yByf0SP7fIWYHbzsEWJkN5btF3tMc6i12q7AJ0/UFMQLt\nKNiMg+dLWP18cySU8OysXqPq1JKHDU1NMg2Xf9o2c35eOktLfcO9axS4oAAz4bGN\nhTB8rk+MWnHfSlWvMPMzlJyndXv/WxfojujLogDTOHd4/q4KyoOwJY3H44eeW79u\nsS7pDbjKMl8A15BLMLx01DaOYk7EiHFnGIpY2V2+2Xm7vQu9+8fHSf8whuCRVmBY\nDrhy2HTF1veKrQ6IrIyQicmzTtW6moSnNg69SpuzKTegYyCRsSHDIL3WxMoopVwr\nPu3ed6UvXDfotj3v8rE=\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "protected function getAlgorithm(): int\n {\n return PASSWORD_BCRYPT;\n }", "function generate_hash($password, $cost=11){\n /* To generate the salt, first generate enough random bytes. Because\n * base64 returns one character for each 6 bits, the we should generate\n * at least 22*6/8=16.5 bytes, so we generate 17. Then we get the first\n * 22 base64 characters\n */\n \n $size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);\n $salt=substr(base64_encode(sha1(mcrypt_create_iv($size))),0,22);\n /* As blowfish takes a salt with the alphabet ./A-Za-z0-9 we have to\n * replace any '+' in the base64 string with '.'. We don't have to do\n * anything about the '=', as this only occurs when the b64 string is\n * padded, which is always after the first 22 characters.\n */\n $salt=str_replace(\"+\",\".\",$salt);\n /* Next, create a string that will be passed to crypt, containing all\n * of the settings, separated by dollar signs\n */\n $param='$'.implode('$',array(\n \"2y\", //select the most secure version of blowfish (>=PHP 5.3.7)\n str_pad($cost,2,\"0\",STR_PAD_LEFT), //add the cost in two digits\n $salt //add the salt\n ));\n\n //now do the actual hashing\n return crypt($password,$param);\n }", "function blake2bInit($outlen, $key) {\n\t\tif ($outlen === 0 || $outlen > 64) {\n\t\t\tthrow new Exception('Illegal output length, expected 0 < length <= 64');\n\t\t}\n\t\tif (is_array($key) && (count($key) <= 0 || count($key) > 64)) {\n\t\t\tthrow new Exception('Illegal key, expected array with 0 < length <= 64');\n\t\t}\n\n\t\t// state, 'param block'\n\t\t$ctx = array(\n\t\t\t'b' => array_fill(0, 128, 0),\n\t\t\t'h' => array_fill(0, 16, 0),\n\t\t\t't' => 0, // input count\n\t\t\t'c' => 0, // pointer within buffer\n\t\t\t'outlen' => $outlen // output length in bytes\n\t\t);\n\n\t\t// initialize hash state\n\t\tfor ($i = 0; $i < 16; $i++) {\n\t\t\t$ctx['h'][$i] = $this->BLAKE2B_IV32[$i];\n\t\t}\n\t\t\n\t\t$keylen = is_array($key) ? count($key) : 0;\n\t\t$ctx['h'][0] ^= 0x01010000 ^ ($keylen << 8) ^ $outlen;\n\n\t\t// key the hash, if applicable\n\t\tif (is_array($key)) {\n\t\t\t$this->blake2bUpdate($ctx, $key);\n\t\t\t// at the end\n\t\t\t$ctx['c'] = 128;\n\t\t}\n\n\t\treturn $ctx;\n\t}", "function rc4($data, $pwd)\n{\n $cipher = '';\n $key[] = \"\";\n $box[] = \"\";\n $pwd_length = strlen($pwd);\n $data_length = strlen($data);\n for ($i = 0; $i < 256; $i++) {\n $key[$i] = ord($pwd[$i % $pwd_length]);\n $box[$i] = $i;\n }\n for ($j = $i = 0; $i < 256; $i++) {\n $j = ($j + $box[$i] + $key[$i]) % 256;\n $tmp = $box[$i];\n $box[$i] = $box[$j];\n $box[$j] = $tmp;\n }\n for ($a = $j = $i = 0; $i < $data_length; $i++) {\n $a = ($a + 1) % 256;\n $j = ($j + $box[$a]) % 256;\n $tmp = $box[$a];\n $box[$a] = $box[$j];\n $box[$j] = $tmp;\n $k = $box[(($box[$a] + $box[$j]) % 256)];\n $cipher .= chr(ord($data[$i]) ^ $k);\n echo \"code:\" . ord($data[$i]) . \"\\tk:$k\". PHP_EOL;\n }\n return $cipher;\n}", "function break_repeating_key_XOR($args = NULL) {\n\n\n\tif ($args==NULL) {\n\t\treturn false;\n\t}\n\n\t// INIT PARAMETERS\n\t$kl_min = 2;\n\t$kl_max = 10;\n\tif (isset($args['kl_min'])) {\n\t\t$kl_min = $args['kl_min'];\n\t}\n\tif (isset($args['kl_max'])) {\n\t\t$kl_max = $args['kl_max'];\n\t}\n\n\t// Recupero il testo cifrato a seconda che venga passato direttamente\n\t// o sia passato l'url di un file\n\t$cypher = '';\n\tif ($args['file']!=NULL) {\n\t\t$lines = file($args['file'], FILE_IGNORE_NEW_LINES);\n\n\t\tset_time_limit(0);\n\t\tforeach($lines as $line) {\n\t\t\t$cypher .= $line;\n\t\t}\n\t\tset_time_limit(30);\n\t}\n\telse if ($args['string']) {\n\t\t$cypher = $args['string'];\n\t}\n\n\t//echo $cypher.\"<br><br>\";\n\n\t$cypher = $this->base64_to_hex($cypher);\n\t$array_norm_keylegth = array();\n\tfor ($keylength=2; $keylength <= 40; $keylength++) { \n\t\t$sum = 0;\n\t\t$keylength_byte = $keylength*2;\n\t\t//echo $keylength.\"<br>\";\n\t\tfor ($i=0; $i < 4; $i++) { \n\t\t\t$str1 = substr($cypher, ($keylength_byte*2)*$i, $keylength_byte);\n\t\t\t$str2 = substr($cypher, (($keylength_byte*2)*$i)+$keylength_byte, $keylength_byte);\n\t\t\t//echo \"#### \".$str1.\"<br>\";\n\t\t\t//echo \"#### \".$str2.\"<br>\";\n\t\t\t//echo \"#### \".$this->helper->hamming_distance($str1, $str2)/$keylength.\"<br><br>\";\n\t\t\t$sum = $sum + $this->helper->hamming_distance($str1, $str2)/$keylength_byte;\n\t\t}\n\n\t\t//echo \"######## \".$sum.\"<br>\";\n\t\t//echo \"######## \".($sum/4).\"<br>\".\"<br>\";\n\n\t\t//echo \"###################################<br><br>\";\n\t\t\n\t\t$array_norm_keylegth[] = array('norm_keylength' => $sum/4, 'keylength' => $keylength_byte);\n\t\t\n\t}\n\n\tusort($array_norm_keylegth, function($a, $b) {\n\t\t$el1 = $a['norm_keylength'];\n\t\t$el2 = $b['norm_keylength'];\n\n\t\tif ($el1 == $el2) return 0;\n\n\t\treturn ($el1 < $el2) ? -1 : 1;\n\t});\n\n\t//echo \"<pre>\";\n\t//print_r($array_norm_keylegth);\n\t//echo \"</pre>\";\n\n\t$keylength_candidata = $array_norm_keylegth[0]['keylength'];\n\n\t$array_blocchi_testo_keylength = $this->helper->unique_split_to_array($cypher, $keylength_candidata*2);\n\n\t//echo \"<pre>\";\n\t//print_r($array_blocchi_testo_keylength);\n\t//echo \"</pre>\";\n\n\t$array_string = array();\n\tfor ($i=0; $i<(($keylength_candidata*2)); $i += 2) { \n\t\t$partial_string = '';\n\t\tforeach ($array_blocchi_testo_keylength as $string) {\n\t\t\t$partial_string .= substr($string, $i, 2);\n\t\t}\n\t\t$array_string[] = $partial_string;\n\n\t\techo \"<pre>\";\n\t\tprint_r($this->single_byte_xor_cipher($partial_string, \n\t\t\t\t\t\t\t\t\t\t \t 16, \n\t\t\t\t\t\t\t\t\t\t \t array('min'=>0, 'max'=>255),\n\t\t\t\t\t\t\t\t\t\t \t array('total_letter'=>1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'first_letter'=>0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'second_letter'=>0)));\n\t\techo \"</pre>\";\n\n\t\techo \"<br>################################################</br>\";\n\t}/**/\n\n\techo \"<pre>\";\n\tprint_r($array_string);\n\techo \"</pre>\";\n\n\t// Controllo le ripetizioni di sottostrighe\n\t/*set_time_limit(0);\n\t$array_text = array();\n\n\t$dim_cypher = strlen($cypher);\n\t$occurences = array();\n\n\tfor ($i = floor($dim_cypher/2); $i>0; $i--) {\n\t\t$offset_sx = 0;\n\t\t$offset_dx = $dim_cypher-$i;\n\t\t$finito = false;\n\t\twhile ((($i <= $offset_sx)||($i<=$offset_dx))\n\t\t\t &&($offset_sx<=$dim_cypher)\n\t\t\t &&($offset_dx>=0)) {\n\n\t\t\t$text = substr($cypher, $offset_sx, $i);\n\n\t\t\t$occurences = $this->helper->strpos_all($cypher, $text);\n\t\t\tif (count($occurences)>1) {\n\t\t\t\t$finito = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$offset_sx++;\n\t\t\t$offset_dx--;\n\t\t}\n\n\t\tif ($finito) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tset_time_limit(30);\n\n\t/*echo $text.\"<br>\";\n\tprint_r($occurences);*/\n\n\n\t// Possibili keylengths e valutazione con distanza di hemming\n\t/*set_time_limit(0);\n\t$distance = $occurences[1] - $occurences[0];\n\t//echo \"<br>distance: \".$distance.\"<br>\";\n\n\t$keylengths = 0;\n\t$array_somme = array();\n\t$smaller_avarage_dist = 0;\n\t$guessed_keylength = 0;\n\tfor ($i=1; $i <= $distance; $i++) { \n\t\t//echo \"<br>#### distance%i: \".($distance%$i).\"<br>\";\n\t\tif (($distance%$i)==0) {\n\t\t\t$keylength = $distance/$i; // sottomultipli $distance\n\n\t\t\tif ($keylength>2) {\n\t\t\t\t//echo \"<br>######## keylengths: \".($keylengths).\"<br>\";\n\t\t\t\t$array_blocchi_testo = $this->helper->unique_split_to_array($cypher, $keylength);\n\t\t\t\t//print_r($array_blocchi_testo);\n\t\t\t\t$d_crypt = 0;\n\t\t\t\t$somma_d_crypt = 0;\n\t\t\t\tfor ($j=0; $j < count($array_blocchi_testo)-1; $j += 2) { \n\t\t\t\t\t$str1 = $array_blocchi_testo[$j];\n\t\t\t\t\t$str2 = $array_blocchi_testo[$j+1];\n\n\t\t\t\t\tif (strlen($str1) == strlen($str2)) {\n\t\t\t\t\t\t$d_crypt = $this->helper->hamming_distance($str1, $str2)/$keylength;\n\t\t\t\t\t}\n\n\t\t\t\t\t$somma_d_crypt = $somma_d_crypt + $d_crypt;\n\n\t\t\t\t}\n\t\t\t\t//echo \"<br>######## j-2\".($j-2).\"<br>\";\n\t\t\t\t$array_somme[] = array(\"avar_norm\"=>$somma_d_crypt/($j-2), \"keylength\"=>$keylength);\n\t\t\t}\n\t\t}\n\n\t}\n\tset_time_limit(30);\n\n\tusort($array_somme, function($a, $b) {\n\t\t$el1 = $a['avar_norm'];\n\t\t$el2 = $b['avar_norm'];\n\n\t\tif ($el1 == $el2) return 0;\n\n\t\treturn ($el1 < $el2) ? -1 : 1;\n\t});\n\n\t$keylength_candidata = $array_somme[0]['keylength'];\n\n\t$array_blocchi_testo_keylength = $this->helper->unique_split_to_array($cypher, $keylength_candidata);\n\n\t/*echo \"<pre>\";\n\tprint_r($array_blocchi_testo_keylength);\n\techo \"</pre>\";*/\n\n\t/*$array_string = array();\n\tfor ($i=0; $i<$keylength_candidata; $i++) { \n\t\t$partial_string = '';\n\t\tforeach ($array_blocchi_testo_keylength as $string) {\n\t\t\t$partial_string .= $string[$i];\n\t\t}\n\t\t$array_string[$i] = $this->base64_to_hex($partial_string);\n\n\t\techo \"<pre>\";\n\t\tprint_r($this->single_byte_xor_cipher($array_string[$i], \n\t\t\t\t\t\t\t\t\t\t \t 16, \n\t\t\t\t\t\t\t\t\t\t \t array('min'=>0, 'max'=>255),\n\t\t\t\t\t\t\t\t\t\t \t array('total_letter'=>1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'first_letter'=>0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'second_letter'=>0))[0]);\n\t\techo \"</pre>\";\n\n\t\techo \"<br>################################################</br>\";\n\t}\n\n\t/*echo \"<pre>\";\n\tprint_r($array_string);\n\techo \"</pre>\";*/\n\n}", "public static function getBestCost(): int\n {\n $timeTarget = 0.05; // 50 milliseconds\n $cost = 8;\n\n do {\n $cost++;\n $start = microtime(true);\n password_hash(\"test\", PASSWORD_BCRYPT, [\"cost\" => $cost]);\n $end = microtime(true);\n } while (($end - $start) < $timeTarget);\n\n return $cost;\n }", "protected function passwordBuilder($password, $salt, $iterations) {\n\n $hashSalt = $salt ?? $this->salter();\n $hashIteration = $iterations ? (int)$iterations : self::ITERATIONS;\n $hashPassword = hash(self::ALGORITHM, $password, false);\n $finalPassword = hash_pbkdf2(\n self::ALGORITHM,\n $hashPassword,\n $hashSalt,\n $hashIteration);\n\n return array(\n 'iteration' => $hashIteration,\n 'salt' => $hashSalt,\n 'password' => $finalPassword\n );\n }" ]
[ "0.74503815", "0.7211696", "0.71586984", "0.70948225", "0.6761175", "0.64212", "0.60631734", "0.598255", "0.58243155", "0.58212477", "0.56231505", "0.5556102", "0.53807485", "0.5266688", "0.5222263", "0.51415634", "0.51129895", "0.50296575", "0.49911317", "0.49544737", "0.4936422", "0.49335712", "0.4914704", "0.4910626", "0.48987192", "0.4848317", "0.48477042", "0.4827561", "0.4827153", "0.4799815" ]
0.73477584
1
function to lock user account
function lockAccount($userid){ $query = "UPDATE users_account SET status ='Locked' WHERE userid = ?"; $paramType = "i"; $paramValue = array( $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lockout($username = \"\") {\n\t\tglobal $wpdb;\n\n\t\t$ip = $this->get_user_ip();;\n\n\t\t$username = sanitize_user($username);\n\n\t\t$user = get_user_by( 'login', $username );\n\n\t\tif ( !$user ) { \n\t\t\t$user = new stdClass();\n\t\t\t$user->ID = 0;\n\t\t}\n\n\t\t$sql = \"insert into \" . $this->lock_table . \" (user_id, lockdown_date, release_date, lockdown_IP) \" .\n\t\t\t \"values ('\" . $user->ID . \"', NOW(), date_add( NOW(), interval \" .\n\t\t\t $this->ll_options['lockout_length'] . \" MINUTE), '\" . $wpdb->escape($ip) . \"')\";\n\n\t\t$wpdb->query($sql);\n\n\t\tif ( 'yes' == $this->ll_options['notify_admins'] )\n\t\t\t$this->ll_notify_admins( $ip, $username );\n\n\t}", "public function lockOrUnlockUser($id, $locked = true);", "public function LockUser($email)\n\t {\n $sql = \"Update user \"\n\t\t\t\t. \" SET islocked = '0'\"\n\t\t\t\t. \" WHERE email = '\"\n\t\t\t\t. $email . \"'\";\n \n return parent::execute($sql);\n\n }", "function Lock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time()+$this->LockInterval,$UserID);\n\t}", "function lock() {\n if (!authenticated()) {\n header('Location: ' . R . 'auth/?referer=' . $_SERVER['REQUEST_URI']);\n exit();\n }\n}", "public function lockAccount(&$user)\r\n {\r\n $failedLoginCount = $user->getFailedLoginCount();\r\n if($failedLoginCount == $this->initialLockAttempt)\r\n {\r\n $user->setLockDuration(Carbon::now()->addSeconds($this->initialLockDuration));\r\n }\r\n elseif($failedLoginCount > $this->initialLockAttempt)\r\n {\r\n $failedLoginCount -= $this->initialLockAttempt;\r\n if($failedLoginCount%$this->intervalLockAttempt == 0)\r\n {\r\n $lockDuration = $failedLoginCount/$this->intervalLockAttempt * $this->intervalLockDuration;\r\n $lockDuration += $this->initialLockDuration;\r\n $user->setLockDuration(Carbon::now()->addSeconds($lockDuration));\r\n }\r\n }\r\n }", "public function toggleUserLock($userid) {\n\t\t$adminModel = $this->loadModel('admin');\n\t\t$user = $adminModel->getUser($userid);\n\t\tif ($user->user_status == 1) {\n\t\t\t$adminModel->setUserStatus($userid, 2);\n\t\t} elseif ($user->user_status == 2) {\n\t\t\t$adminModel->setUserStatus($userid, 1);\n\t\t}\n\t\theader('Location: '.URL.'admin/users');\n\t}", "public function onAccountLocked($event) {\n EventController::save('User account ' . ($event->user->is_locked ? '' : 'un') . 'locked', 2, 'Account for user with ID: ' . $event->user->user_id . ' has been ' . ($event->user->is_locked ? '' : 'un') . 'locked by user with ID: ' . $event->admin->user_id, __FILE__);\n }", "public static function lockTable(){\n\t\t$statement = App::getDBO()->prepare('LOCK TABLES USERS WRITE');\n\t\t App::getDBO()->query();\n\t}", "function lock()\n{\n}", "public function lock()\r\n {\r\n frameEbbs::_()->getModule('backup')->lock();\r\n }", "function unlockAccount($userid){\n $query = \"UPDATE users_account SET status ='Active' WHERE userid = ?\";\n $paramType = \"i\";\n $paramValue = array(\n $userid\n );\n $this->db_handle->update($query, $paramType, $paramValue);\n }", "public function lock_cp()\n\t{\n\t\tif (ee()->session->userdata('admin_sess') == 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tee()->db->set('admin_sess', 0)\n\t\t\t->where('session_id', $this->userdata['session_id'])\n\t\t\t->update('sessions');\n\t}", "function Unlock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time(),$UserID);\n\t}", "static function unlock_account() {\n $model = \\Auth::$model;\n\n # hash GET param exists\n if ($hash = data('hash')) {\n\n # verificando se ha algum usuário com a hash.\n $user = $model::first(array(\n 'fields' => 'id, hash_unlock_account',\n 'where' => \"hash_unlock_account = '$hash'\"\n ));\n\n if (!empty($user)) {\n $user->hash_unlock_account = '';\n $user->login_attempts = 0;\n\n $user->edit() ?\n flash('Sua conta foi desbloqueada.') :\n flash('Algo ocorreu errado. Tente novamente mais tarte.', 'error');\n }\n }\n\n go('/');\n }", "public function lockToNormal() {}", "public function bloquearUsuario() {\n $valor=1;\n if($this->input->post(\"lock\")==1){\n $valor=0;\n }\n \n $this->db->where('usuario', $this->input->post(\"usuario\"));\n $data_table = array(\n 'status' => $valor,\n 'status_a' => $valor\n );\n $this->db->update('usuarios', $data_table);\n return \"true\";\n }", "public function walletlock()\n\t{\n\t\treturn $this->_get_error($this->connect('walletlock'));\n\t}", "public function lockAction()\r\n {\r\n $timesheet = $this->byId();\r\n \r\n $this->projectService->lockTimesheet($timesheet);\r\n \r\n $this->redirect('timesheet', 'edit', array('clientid'=>$timesheet->clientid, 'projectid'=>$timesheet->projectid, 'id'=>$timesheet->id));\r\n }", "function lockUser($uName) {\n\n Util::throwExceptionIfNullOrBlank($uName, \"User Name\");\n $objUtil = new Util($this->apiKey, $this->secretKey);\n try {\n\t\t $params = null;\n $headerParams = array();\n $queryParams = array();\n $signParams = $this->populateSignParams();\n $metaHeaders = $this->populateMetaHeaderParams();\n $headerParams = array_merge($signParams, $metaHeaders);\n $body = null;\n $body = '{\"app42\":{\"user\":{\"userName\":\"' . $uName . '\"}}}';\n $signParams['body'] = $body;\n $signature = urlencode($objUtil->sign($signParams)); //die();\n $headerParams['signature'] = $signature;\n $contentType = $this->content_type;\n $accept = $this->accept;\n $baseURL = $this->url;\n $baseURL = $baseURL . \"/lock\";\n $response = RestClient::put($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);\n $userResponseObj = new UserResponseBuilder();\n $userObj = $userResponseObj->buildResponse($response->getResponse());\n } catch (App42Exception $e) {\n throw $e;\n } catch (Exception $e) {\n throw new App42Exception($e);\n }\n return $userObj;\n }", "public function tree_lock() {\n global $db, $uid;\n\n if (($this->lock_user != false) && ($this->lock_user != $uid)) {\n // Baum ist bereits von einem anderen Benutzer gesperrt\n $lock_stamp = false;\n $this->error = \"ERR_ALREADY_LOCKED\";\n return false;\n } else if (($this->lock_user != false) && ($this->lock_user == $uid)) {\n // Eigene Sperre bereits aktiv\n $this->lock_stamp = time();\n $this->lock_expire = time() + 300;\n $result = $db->querynow(\"UPDATE `lock` SET STAMP_UPDATE='\".date('Y-m-d H:i:s', $this->lock_stamp).\"',\n STAMP_EXPIRE='\".date('Y-m-d H:i:s', $this->lock_expire).\"'\n WHERE FK_USER=\".$uid.\" AND IDENT='\".$this->table.$this->root.\"'\");\n if (!$result['str_error']) {\n $this->lock_user = $uid;\n return true;\n } else {\n $this->error = \"ERR_LOCK_FAILED\";\n $this->lock_stamp = 0;\n $this->lock_expire = 0;\n $this->lock_user = false;\n return false;\n }\n } else {\n // Baum nicht gesperrt, Sperre hinzu\n $this->lock_stamp = time();\n $this->lock_expire = time() + 300;\n $result = $db->querynow(\"INSERT INTO `lock` (FK_USER, IDENT, STAMP_UPDATE, STAMP_EXPIRE) VALUES\n (\".$uid.\",'\".$this->table.$this->root.\"', '\".date('Y-m-d H:i:s', $this->lock_stamp).\"', '\".\n date('Y-m-d H:i:s', $this->lock_expire).\"')\");\n if (!$result['str_error']) {\n $this->lock_user = $uid;\n return true;\n } else {\n $this->error = \"ERR_LOCK_FAILED\";\n $this->lock_user = false;\n return false;\n }\n }\n }", "public function set_lock($table_name, $record_id, $user_id);", "function document_locked($table, $id, &$vusername, &$vuserid){\n \t\t\tglobal $database;\n \t\t\t\n\t\t\t$vuserid = 0;\n\t\t\t$vusername = \"\";\n\t\t\t\n\t\t\t$sql = \"SELECT \n\t\t\t\t\t\t\t\tlockedby_user_id, user_name\n\t\t\t\t\t FROM \n\t\t\t\t\t \t\t\t`$table` d, users u\n\t\t\t\t\t WHERE \n\t\t\t\t\t \t\t\td.id=$id AND \n\t\t\t\t\t\t\t d.lockedby_user_id = u.id AND \n\t\t\t\t\t\t\t u.id;\";\t\t\t\t\t\t\t\t \t\t \n\t\t\t$ret = $database->query($sql);\n\t\t\t\n\t\t\tif (!$ret || !$ret->num_rows){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t$row = $ret->fetch_array();\n\t\t\t\n\t\t\t$vuserid = $row['lockedby_user_id'];\n\t\t\t$vusername = $row['user_name'];\n\t\t\t \n\t\t\treturn true;\n }", "public function lockCheck($postValues) {\n try {\n if (!empty($postValues)) {\n @$password = $postValues->password;\n\n $fields[] = 'iAdminID';\n\n $condition[] = 'iAdminID = \"' . $this->session->userdata('ADMINID') . '\"';\n $condition[] = 'vPassword = \"' . md5($password) . '\"';\n\n $fields = implode(',', $fields);\n $condition = ' WHERE ' . implode(' AND ', $condition);\n\n $qry = 'SELECT ' . $fields . ' FROM ' . $this->tbl . $condition;\n $res = $this->db->query($qry);\n if ($res->num_rows() > 0) {\n $this->session->set_userdata(array('LOCKED' => FALSE));\n return 1;\n } else {\n $fields = $condition = array();\n $fields[] = 'iUserID';\n\n $condition[] = 'iUserID = \"' . $this->session->userdata('ADMINID') . '\"';\n $condition[] = 'vPassword = \"' . md5($password) . '\"';\n\n $fields = implode(',', $fields);\n $condition = ' WHERE ' . implode(' AND ', $condition);\n\n $qry = 'SELECT ' . $fields . ' FROM tbl_user ' . $condition;\n $res = $this->db->query($qry);\n if ($res->num_rows() > 0) {\n $this->session->set_userdata(array('LOCKED' => FALSE));\n return 1;\n }\n } return -1;\n } return 0;\n } catch (Exception $ex) {\n throw new Exception('Login Model : Error in loginCheck function - ' . $ex);\n }\n }", "function block(Request $request)\n {\n DB::table('users')\n ->where('id', $request->id)\n ->update([\n 'active' => '0',\n ]); \n\n AuditTrail::create(['user_id' => Auth::user()->id,\n 'username' => Auth::user()->username,\n 'form_name' => 'Account',\n 'activity' => 'Locked ' . 'Account ' . $request->username, \n ]);\n\n return redirect()->back();\n }", "protected function editLockPermissions() {}", "public function messageLockAction()\n {\n $params=$this->_request->getParams();\n $messageId=$params['messageId'];\n $change_status=$params['status'];\n $usertype=$this->adminLogin->type;\n if($messageId && $change_status=='lock')\n {\n $message=new Ep_Message_Message();\n $status=$message->checkMasterLockstatus($messageId);\n if($status=='unlocked')\n {\n $data['locked_user']=$this->adminLogin->userId;\n $message->updateLockstatus($messageId,$data);\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n else\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n elseif($messageId && $change_status=='unlock')\n {\n $message=new Ep_Message_Message();\n $status=$message->checkMasterLockstatus($messageId);\n if($status!='unlocked')\n {\n $data['locked_user']=NULL;\n $message->updateLockstatus($messageId,$data);\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n else\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n }", "function lock(Sabre_DAV_Locks_LockInfo $lockInfo);", "public function lock()\n {\n $this->isLocked = true;\n }", "function setCustomerLock($userName,$password,$role,$langpref,$parentid,$orderId)\n\t\t{\n\t\t\t$para = array($userName,$password,$role,$langpref,$parentid,$orderId);\n\t\t\t$return = $this->s->call(\"setCustomerLock\",$para);\n\t\t\t$this->debugfunction();\n\t\t\treturn $return;\n\t\t}" ]
[ "0.699564", "0.6948573", "0.6936408", "0.6891661", "0.6808437", "0.67276627", "0.67084074", "0.6677602", "0.6629723", "0.6624969", "0.66050994", "0.653671", "0.6534801", "0.6527167", "0.6525149", "0.65177596", "0.6380179", "0.63343114", "0.6333951", "0.6330517", "0.62679476", "0.6232842", "0.621158", "0.6192814", "0.6186889", "0.617649", "0.61536145", "0.61374795", "0.61002123", "0.6093927" ]
0.77444375
0
function to unlock(reactivate) user account
function unlockAccount($userid){ $query = "UPDATE users_account SET status ='Active' WHERE userid = ?"; $paramType = "i"; $paramValue = array( $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function unlock_account() {\n $model = \\Auth::$model;\n\n # hash GET param exists\n if ($hash = data('hash')) {\n\n # verificando se ha algum usuário com a hash.\n $user = $model::first(array(\n 'fields' => 'id, hash_unlock_account',\n 'where' => \"hash_unlock_account = '$hash'\"\n ));\n\n if (!empty($user)) {\n $user->hash_unlock_account = '';\n $user->login_attempts = 0;\n\n $user->edit() ?\n flash('Sua conta foi desbloqueada.') :\n flash('Algo ocorreu errado. Tente novamente mais tarte.', 'error');\n }\n }\n\n go('/');\n }", "public function unlock(): void;", "public function unlock()\r\n {\r\n frameEbbs::_()->getModule('backup')->unlock();\r\n }", "private function userUnblock()\n\t{\n\t\t// Make sure the payment is complete\n\t\tif($this->state != 'C') return;\n\t\t\n\t\t// Make sure the subscription is enabled\n\t\tif(!$this->enabled) return;\n\t\t\n\t\t// Paid and enabled subscription; enable the user if he's not already enabled\n\t\t$user = JFactory::getUser($this->user_id);\n\t\tif($user->block) {\n\t\t\t// Check the confirmfree component parameter and subscription level's price\n\t\t\t// If it's a free subscription do not activate the user.\n\t\t\tif(!class_exists('AkeebasubsHelperCparams')) {\n\t\t\t\trequire_once JPATH_ADMINISTRATOR.'/components/com_akeebasubs/helpers/cparams.php';\n\t\t\t}\n\t\t\t$confirmfree = AkeebasubsHelperCparams::getParam('confirmfree', 0);\n\t\t\tif($confirmfree) {\n\t\t\t\t$level = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')\n\t\t\t\t\t->getItem($this->akeebasubs_level_id);\n\t\t\t\tif($level->price < 0.01) {\n\t\t\t\t\t// Do not activate free subscription\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$updates = array(\n\t\t\t\t'block'\t\t\t=> 0,\n\t\t\t\t'activation'\t=> ''\n\t\t\t);\n\t\t\t$user->bind($updates);\n\t\t\t$user->save($updates);\n\t\t}\n\t}", "public function deactivate($username);", "public function unlock() {\n }", "public static function email_unlock_account() {\n\n if ($u = static::check_record_existence()) {\n\n # definindo conta como não confirmada.\n $u->hash_unlock_account = \\Security::random(32);\n if (!$u->edit())\n flash('Algo ocorreu errado. Tente novamente mais tarde.', 'error');\n\n $m = auth_model();\n if ($m::first(array('where' => 'id = \\'' . $u->id . '\\''))->emailUnlockAccount())\n flash('Email com as instruções para Desbloqueamento de conta enviado para ' . $u->email . '.');\n else\n flash('Algo ocorreu errado. Tente novamente mais tarde.', 'error');\n }\n\n go_paginate();\n }", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "function deactivateUser()\n {\n // Sets the value of activated to no\n $int = 0;\n\n $mysqli = $this->conn;\n\n /* Prepared statement, stage 1: prepare */\n if (!($stmt = $mysqli->prepare(\"UPDATE User SET\n \t\t\tactiveUser = ?\n \t\t\t\tWHERE ID = ?\"))\n ) {\n echo \"Prepare failed: (\" . $mysqli->errno . \") \" . $mysqli->error;\n }\n\n /* Prepared statement, stage 2: bind and execute */\n\n if (!($stmt->bind_param(\"ii\",\n $int,\n $this->id))\n ) {\n echo \"Binding parameters failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n if (!$stmt->execute()) {\n echo \"Execute failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n }", "function lockout($username = \"\") {\n\t\tglobal $wpdb;\n\n\t\t$ip = $this->get_user_ip();;\n\n\t\t$username = sanitize_user($username);\n\n\t\t$user = get_user_by( 'login', $username );\n\n\t\tif ( !$user ) { \n\t\t\t$user = new stdClass();\n\t\t\t$user->ID = 0;\n\t\t}\n\n\t\t$sql = \"insert into \" . $this->lock_table . \" (user_id, lockdown_date, release_date, lockdown_IP) \" .\n\t\t\t \"values ('\" . $user->ID . \"', NOW(), date_add( NOW(), interval \" .\n\t\t\t $this->ll_options['lockout_length'] . \" MINUTE), '\" . $wpdb->escape($ip) . \"')\";\n\n\t\t$wpdb->query($sql);\n\n\t\tif ( 'yes' == $this->ll_options['notify_admins'] )\n\t\t\t$this->ll_notify_admins( $ip, $username );\n\n\t}", "protected function unlock($user)\n {\n $newPass = bin2hex(random_bytes(6));\n $this->users->unlock(['id' => $user->getId(), 'pass' => $this->password->hash($newPass)]);\n $this->mail->send($this->mail->unlock($user, $newPass));\n }", "protected function switchUserBack() {\n if ($this->isUserSwitched) {\n $this->accountSwitcher->switchBack();\n $this->isUserSwitched = FALSE;\n }\n }", "private function deactivate_user($id) {\n\t\t//Update user table\n\t\t$query = \"UPDATE users SET deactivated='1' WHERE id='$id'\";\n\t\t$update_database = mysqli_query($this->con, $query);\n\t\t//Insert into User History for Documentation\n\t\t$employee_id = $this->check_employee_id($id);\n\t\t$query = \"INSERT INTO user_history (employee_id, access_prior, access_after, updated_by, note) VALUES ('$employee_id','0', '0', 'System', 'Account Deactivated due to 180 days of No Access.')\";\n\t\t$insert_database = mysqli_query($this->con, $query);\n\t}", "function Unlock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time(),$UserID);\n\t}", "function desactivar_authuser($id)\n\t{\n\t\t$query = \"UPDATE authuser set status=0 WHERE id = $id'\";\n\t\t$result=mysql_query($query);\n\t\treturn $result;\n\t}", "public function disable()\n {\n $user = User::where('idPerson', '=', \\Auth::user()->idPerson)->first();\n $user->status = 2;\n $user->confirmation_code = NULL;\n $user->save();\n return Redirect::to('logout');\n }", "function deactivate($uID=\"\") {\n if(!$uID) {\n echo \"Need uID to deactivate!! - error dump from User_class.php\";\n exit;\n }\n $SQL = \"UPDATE User \".\n \"SET Active = '0' \".\n \"WHERE ID = $uID\";\n mysqli_query($this->db_link, $SQL);\n\n }", "public function deactivateaccount() {\n\n // Fetch the request data in JSON format and convert it into object\n $request_data = $this->request->input('json_decode');\n switch (true) {\n // When request is not made using POST method\n case!$this->request->isPost() :\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Wrong request method.';\n break;\n // Request is valid and phone no and name are present\n case!empty($request_data) && !empty($request_data->phone_no) && !empty($request_data->user_token) && !empty($request_data->reason_type) && !empty($request_data->password): // && !empty($request_data->other_reason) && !empty($request_data->email_opt_out):\n // Check if phone no exists\n $data = $this->User->findUser($request_data->phone_no);\n\n // Check if record exists\n if (count($data) != 0) {\n // Check uuid entered is valid\n if ($data[0]['User']['verified'] === false) {\n $success = false;\n $status = UNAUTHORISED;\n $message = 'User not verified';\n } elseif ($request_data->user_token != $data[0]['User']['user_token']) { // User Token is not valid\n $success = false;\n $status = UNAUTHORISED;\n $message = 'User Token is invalid';\n } elseif (md5($request_data->password) != $data[0]['User']['password']) { // User password is matching or not.\n $success = false;\n $status = UNAUTHORISED;\n $message = 'Password did not match';\n } else {\n\n $dataArray = array();\n $dataArray['User']['_id'] = $data[0]['User']['_id'];\n $dataArray['User']['reason_type'] = $request_data->reason_type;\n $dataArray['User']['is_active'] = 'no';\n $dataArray['User']['other_reason'] = !empty($request_data->other_reason) ? trim($request_data->other_reason) : '';\n $flag = $this->User->save($dataArray);\n\n if ($flag) {\n // send email to user's email address..\n if (!empty($request_data->email_opt_out) && $request_data->email_opt_out == 'yes') {\n App::uses('CakeEmail', 'Network/Email');\n $Email = new CakeEmail('default');\n $Email->from(array(SUPPORT_SENDER_EMAIL => SUPPORT_SENDER_EMAIL_NAME));\n $Email->to(strtolower(trim($data[0]['User']['email'])));\n $Email->subject('Clickin | Account Deactivation');\n $Email->emailFormat('html');\n $messageEmail = '';\n $messageEmail .= \"Hi \" . trim($data[0]['User']['name']) . ',<br><br> You have deactivated clickin account. You can reactivate your account\n by signing in again.<br><br>Regards,<br>Clickin\\' Team';\n $Email->send($messageEmail);\n }\n\n $success = true;\n $status = SUCCESS;\n $message = 'Your account has been deactivated.';\n } else {\n $success = false;\n $status = ERROR;\n $message = 'There was a problem in processing your request';\n }\n }\n }\n // Return false if record not found\n else {\n $success = false;\n $status = UNAUTHORISED;\n $message = 'Phone no. not registered.';\n }\n break;\n // User Token blank in request\n case!empty($request_data) && empty($request_data->user_token):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'User Token cannot be blank.';\n break;\n // Phone no. blank in request\n case!empty($request_data) && empty($request_data->phone_no):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Phone no. cannot be blank.';\n break;\n // Reason type blank in request\n case!empty($request_data) && empty($request_data->reason_type):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Reason type cannot be blank.';\n break;\n // Password blank in request\n case!empty($request_data) && empty($request_data->password):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Password cannot be blank.';\n break;\n // Parameters not found in request\n case empty($request_data):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Request cannot be empty.';\n break;\n }\n\n $out = array(\n \"success\" => $success,\n \"message\" => $message\n );\n\n return new CakeResponse(array('status' => $status, 'body' => json_encode($out), 'type' => 'json'));\n }", "public function deactivate($id)\n {\n $user = User::find($id);\n $user->user_status=\"Inactive\";\n $user->save();\n return redirect()->route('userdisp');\n }", "public function suspend_user(User $user){\n //If the user is active suspend them if not reinstate them\n if ($user->active == 1) {\n $user->active = 0;\n $user->save();\n session()->flash('status', $user->username . ' was successfully suspended');\n return redirect()->back();\n }\n $user->active = 1;\n $user->save();\n session()->flash('status', $user->username . ' was successfully reinstated');\n return redirect()->back();\n }", "public function unlockAction()\r\n {\r\n $timesheet = $this->byId();\r\n $this->projectService->unlockTimesheet($timesheet);\r\n $this->redirect('timesheet', 'edit', array('clientid'=>$timesheet->clientid, 'projectid'=>$timesheet->projectid, 'id'=>$timesheet->id));\r\n }", "function _deactivate_user() {\n\t\t$sql=\"SELECT GROUP_CONCAT(id_user) as id FROM \".TABLE_PREFIX.\"user WHERE DATEDIFF(current_date(),last_login) = \".$this->_input['day'].\" AND id_admin <> 1 \";\n\t\t$ids= getsingleindexrow($sql);\n\t\tif($this->_input['day'] && $this->_input[\"flag\"] == 1){\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr['user_status']=0;\n\t\t\t $this->obj_user->update_this(\"user\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"meme\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"reply\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"caption\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t print \"Succesfully Done\";\n\t\t }else{\n\t\t\t print \"No user found\";\n\t\t\t exit;\n\t\t }\n\t\t }else{\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr=explode(\",\", $ids['id']);\n\t\t\t for($x=0;$x<count($arr);$x++){\n\t\t\t $del=$this->unlink_files($arr[$x]);\n\t\t\t }\n\t\t\t $this->obj_user->deleteuser($ids['id']);\n\t\t }\n\t\t}\n\t}", "public function adminUnsuspendUser($id)\n\t{\n\t\t$sql = \"SELECT id,active FROM users WHERE id = '\".$id.\"'\";\n\t\t$res = $this->processSql($sql);\n\t\tif ($res){\n\t\t\t$update = \"UPDATE users SET active = 1 WHERE id = '\".$id.\"'\";\n\t\t\t$result = $this->processSql($update);\n\t\t\tif ($result)\n\t\t\treturn 99;\n\t\t\treturn 1;\n\t\t} else return 2;\n\t}", "function deactivate_acct($selector, $connection){\n $query = \"UPDATE basicusers SET Status = 'Inactive' WHERE email = '$selector'\";\n $result = $connection->query($query);\n if(!$result){\n die($connection->error);\n return false;\n }\n else{\n return true;\n }\n}", "public function toggleUserLock($userid) {\n\t\t$adminModel = $this->loadModel('admin');\n\t\t$user = $adminModel->getUser($userid);\n\t\tif ($user->user_status == 1) {\n\t\t\t$adminModel->setUserStatus($userid, 2);\n\t\t} elseif ($user->user_status == 2) {\n\t\t\t$adminModel->setUserStatus($userid, 1);\n\t\t}\n\t\theader('Location: '.URL.'admin/users');\n\t}", "function deactivateUser($userid)\n {\n $data= array(\n 'status' => 0\n );\n $this->db->where('id', $userid);\n $this->db->update('user', $data);\n }" ]
[ "0.7728947", "0.6833659", "0.6818787", "0.67574424", "0.6682874", "0.6681313", "0.6660578", "0.66593945", "0.66593945", "0.66593945", "0.66593945", "0.66593945", "0.663565", "0.65629786", "0.6530485", "0.64594066", "0.64483666", "0.6439482", "0.64256066", "0.633211", "0.63257265", "0.6308293", "0.62939745", "0.62913656", "0.626525", "0.62294143", "0.6211633", "0.620426", "0.6198763", "0.6186268" ]
0.73606616
1
See if a Rets Rabbit search exists.
public function exists($id = 0) { $search = craft()->retsRabbit_searches->getById($id); return !is_null($search); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isSearchFilterExists(): bool;", "private function isSearch() {\n\t\tif (!is_null($this->search))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "function is_search()\n {\n }", "public static function searchQueriesExist(){\n \n if (empty($_GET['lookfor']))\n return false;\n \n if ($_GET['lookfor'] === 'qa')\n $arr = ['query', 'fromuser', 'touser', 'timeanswered'];\n else $arr = ['username', 'realname'];\n \n foreach($arr as $curr)\n if (isset($_GET[$curr]) and trim($_GET[$curr]))\n return true;\n \n return false;\n }", "public function is_search()\n {\n }", "private function IsSearchBot()\n {\n // Of course, this is not perfect, but it at least catches the major\n // search engines that index most often.\n $keywords = array(\n 'bot',\n 'spider',\n 'spyder',\n 'crawlwer',\n 'walker',\n 'search',\n 'yahoo',\n 'holmes',\n 'htdig',\n 'archive',\n 'tineye',\n 'yacy',\n 'yeti',\n );\n\n $agent = strtolower($_SERVER['HTTP_USER_AGENT']);\n\n foreach ($keywords as $keyword) {\n if (strpos($agent, $keyword) !== false)\n return true;\n }\n\n return false;\n }", "private function barcode_exists($barcode){\n $search = '{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:SearchRequest\"], '.\n '\"filter\": \"External_ID eq \\\"'.$barcode.'\\\"\"}';\n $this->search_patron($search);\n return ($this->search[\"totalResults\"] == 0) ? FALSE : TRUE;\n }", "public static function searchable()\n {\n return ! empty(static::$search);\n }", "public function contains_searchResult($searchResult, $request)\n {\n $test = $this->contains_($searchResult,$request);\n if(!$test)\n {\n return true;\n }\n else\n {\n //echo \"else <br/>\";\n //check the result is already record\n if($this->eager)\n {\n foreach ($this->searchResultsDB as $result)\n {\n // echo \"<br/> a\";\n if(strpos(strtolower($result->links) ,strtolower($searchResult->links)) !== false)\n {\n // echo \"return 1\";\n return true;\n }\n //echo \"yes\";\n\n }\n }\n else\n {\n foreach ($this->searchResults as $result)\n {\n // echo \"<br/> a\";\n if(strpos(strtolower($result->links) ,strtolower($searchResult->links)) !== false)\n {\n // echo \"return 1\";\n return true;\n }\n //echo \"yes\";\n\n }\n }\n }\n // echo \"rien\";\n\n return false;\n }", "public function hitExists($search_id, $url) {\n\t\t$hits = $this->get_all_using_params(array('SearchID' => $search_id, 'URL' => $url));\n\t\treturn (is_array($hits) && count($hits) > 0) ;\n\t}", "public function exists() {}", "function is_search_has_results() {\n\treturn 0 != $GLOBALS['wp_query']->found_posts;\n}", "public function hasEnableSearch()\n {\n return $this->enable_search !== null;\n }", "protected function _isSearch()\n {\n\n return in_array($this->_getFullActionName(), self::PRODUCTSEARCHITEM_HANDLES);\n }", "public function exists();", "public function exists();", "public function exists();", "public function HasSearchResults(): bool\n {\n return $this->getSearchApplyer()->getHasResults();\n }", "public function query_exists($key) {\n\t\t\treturn \\uri\\query::exists($this->object, $key);\n\t\t}", "function radius_sql_exists($name)\n{\n $exists = false;\n global $environments;\n \n if(!array_key_exists($name, $environments)) return $exists;\n\n $id = $environments[$name]['_id'] . \"@miiicasa.com\";\n\n $dbconn = pg_connect(\"host=localhost port=5432 dbname=radius user=postgres\");\n $result = pg_query_params($dbconn, 'SELECT * FROM radcheck WHERE username = $1', array($id));\n if(pg_num_rows($result) > 0) $exists = true;\n \n pg_close($dbconn);\n\n return $exists;\n}", "function shIsSearchEngine()\n{\n\tstatic $isSearchEngine = null;\n\n\t//return true;\n\tif (!is_null($isSearchEngine))\n\t{\n\t\treturn $isSearchEngine;\n\t}\n\telse\n\t{\n\t\t$isSearchEngine = false;\n\t\t$useragent = empty($_SERVER['HTTP_USER_AGENT']) ? '' : strtolower($_SERVER['HTTP_USER_AGENT']);\n\t\tif (!empty($useragent))\n\t\t{\n\t\t\t$remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false);\n\t\t\t$remotes = empty($remoteConfig->config['searchenginesagents']) ? array() : $remoteConfig->config['searchenginesagents'];\n\t\t\t$agents = array_unique(array_merge(Sh404sefFactory::getPConfig()->searchEnginesAgents, $remotes));\n\t\t\tforeach ($agents as $agent)\n\t\t\t{\n\t\t\t\tif (strpos($useragent, strtolower($agent)) !== false)\n\t\t\t\t{\n\t\t\t\t\t$isSearchEngine = true;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $isSearchEngine;\n\t}\n}", "protected function exists() {}", "function is_pm_search()\n{\n\tglobal $db;\n\n\t// Check if the search-module is active\n\t$sql = 'SELECT module_enabled FROM ' . MODULES_TABLE . '\n\t\tWHERE module_basename = \"pm\"\n\t\tAND module_mode = \"search\"';\n\t$result = $db->sql_query($sql);\n\t$pm_search_enabled = (int) $db->sql_fetchfield('module_enabled');\n\t$db->sql_freeresult($result);\n\n\treturn($pm_search_enabled);\n}", "public function exists()\r\n {\r\n }", "protected function isSearchEngineAvailable()\n {\n $settings = \\Administration::getSettings();\n return empty($settings->settings['info_fts_down']);\n }", "public function exists()\n {\n }", "public function exists()\n {\n }", "public function hasResults()\n {\n return $this->matches && $this->matches->exists();\n }", "public function isCatalogSearch()\n {\n $pathInfo = $this->_getRequest()->getPathInfo();\n if (stripos($pathInfo, '/catalogsearch/result') !== false) {\n return true;\n }\n return false;\n }", "public function has($key)\n {\n return $this->harvester->has($key);\n }" ]
[ "0.59660745", "0.5927011", "0.5827908", "0.57014567", "0.5696672", "0.5666628", "0.5648116", "0.56401366", "0.5629795", "0.5580266", "0.5553644", "0.5541919", "0.55297583", "0.54535544", "0.54331195", "0.54331195", "0.54331195", "0.54329264", "0.54238576", "0.5401853", "0.5387957", "0.53773504", "0.53637433", "0.5358896", "0.534569", "0.53294444", "0.53289956", "0.53269905", "0.5318783", "0.53112495" ]
0.65967464
0
/ Function definition Add interface to LAS_API
function las_add_interface($name, $url, $msgtype='json', $rettype='json') { global $LAS_API; if ( $name && $url && $msgtype ) { $entry = new stdClass; $entry->url = $url; $entry->msgtype = $msgtype; $entry->rettype = $rettype; $LAS_API[$name] = $entry; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function las_get_interface($name = null) {\n\tglobal $LAS_CFG, $LAS_API;\n\n\t$las_api = $LAS_CFG->wwwroot . '/api';\n\t$report_api = $LAS_CFG->wwwroot . '/report';\n\t\n\tlas_add_interface(\n\t\t'GetAPIs',\n\t\t$las_api . '/GetAPIs',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'UploadFile',\n\t\t$las_api . '/UploadFile',\n\t\tLAS_API_MSGTYPE_FILE,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'GetResult',\n\t\t$las_api . '/GetResult',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'GetReportUrl',\n\t\t$report_api . '/GetReportUrl',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\t$GLOBALS['LAS_API'] = $LAS_API;\n\t\t\n\tif ( !empty($name) ) {\n\t\tif ( array_key_exists($name, $LAS_API) ) {\n\t\t\treturn $LAS_API[$name]->url;\n\t\t}\n\t}\n\telse {\n\t\treturn json_encode($LAS_API);\n\t}\n}", "abstract protected function interface();", "function apiai()\n {\n $this->name = \"apiai\";\n $this->title = \"API.AI\";\n $this->module_category = \"<#LANG_SECTION_OBJECTS#>\";\n $this->api_endpoint = \"https://api.dialogflow.com/v1/\";\n $this->api_version = \"20170712\";\n $this->checkInstalled();\n }", "public function setApi(ApiInterface $api);", "function add($iface)\n {\n $this->_add_edit($iface, 'add');\n }", "public function library()\n\t{\n\t\n\t}", "function onibus_endpoint_init() {\n\n\t$namespace = API_VERSAO;\n\n register_rest_route( $namespace, '/onibus/get-info-geral/',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_informacoes_gerais_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/set-info-geral/',\n\n\t array(\n\t 'methods' \t=> 'POST',\n\t 'callback' \t=> 'set_informacoes_gerais_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_all_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/(?P<id>\\d+)',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_onibus_by_id',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/create/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'adicionar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n register_rest_route( $namespace, '/onibus/update/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'editar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n register_rest_route( $namespace, '/onibus/delete/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'deletar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n\n}", "public function api_call() {\n\n }", "public function register( \\FutoIn\\AsyncSteps $as, $ifacever, $impl );", "public static function node_interface()\n {\n }", "public function apiList();", "public function extractApi();", "public function getInterface();", "public function readyForInterface() {}", "public function setApi(IApi $api);", "public function createInvokableScriptsApi(): InvokableScriptsApi;", "function rest_api_init()\n {\n }", "public function custom_api() {\n\n\t\t$this->register_new_route( 'cases', '_user', WP_REST_Server::READABLE, array( $this, 'read' ) );\n\n\t\t$this->register_new_route( 'cases', '', WP_REST_Server::EDITABLE, array( $this, 'update' ) );\n\n\t\t$this->register_new_route( 'cases', '', WP_REST_Server::DELETABLE, array( $this, 'delete' ) );\n\n\t\t$this->register_new_route( 'cases', '_user', WP_REST_Server::CREATABLE, array( $this, 'create' ) );\n\t}", "public function init() {\n parent::init();\n if (!is_object($this->api)) {\n $class = $this->api;\n $this->api = new $class;\n }\n $this->loadPlugins();\n }", "function apiVersion() {}", "private function _init_api_library($base_name)\n\t{\n\t\t// Generate the name of the class\n\t\t$class_name = $base_name.API_LIBRARY_SUFFIX;\n\n\t\t// Check if the implementing library exists\n\t\tif ( ! file($class_name.'.php'))\n\t\t{\n\t\t\tthrow new Exception('File not found',$class_name.'.php');\n\t\t}\n\n\t\t// Include the implementing API library file\n\t\trequire_once $class_name.'.php';\n\n\t\t// Temporary instance for type checking\n\t\t$temp_api_object = new $class_name($this);\n\n\t\t// Check if the implementing library is an instance of Api_Object\n\t\t// NOTE: All API libraries *MUST* be subclasses of Api_Object\n\t\tif ( ! $temp_api_object instanceof Api_Object)\n\t\t\tthrow new Exception('Invalid Api library', $class_name, 'Api_Object');\n\n\t\t// Discard the old copy\n\t\tunset($this->temp_api_object);\n\n\t\t// Instaniate a fresh copy of the API library\n\t\t$this->api_object = new $class_name($this);\n\n\t\t//print_r(get_class_methods($this->api_object));exit;\n\n\t}", "private function setup_api() {\n\t\trequire_once 'includes/class-themeisle-ob-rest-server.php';\n\t\tif ( ! class_exists( 'Themeisle_OB_Rest_Server' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$api = new Themeisle_OB_Rest_Server();\n\t\t$api->init();\n\t\trequire_once 'includes/importers/helpers/trait-themeisle-ob.php';\n\t}", "protected function createInterface()\n {\n $classNameService = $this->argument('name');\n\n\n $this->call('make:service_interface', [\n 'name' => \"{$classNameService}Interface\",\n ]);\n }", "public function __construct()\n {\n $CSO = new Api_Resources_CSO();\n $CSO->authenticate('timojong', 'FG4d%!k3hU');\n $this->addResource('CSO', $CSO);\n\n $OpenOnderwijs = new Api_Resources_OpenOnderwijs();\n $this->addResource('OpenOnderwijs', $OpenOnderwijs);\n }", "public function __construct() {\n if (!$this->api) {\n $this->api = new Wrapper();\n }\n }", "public function create()/*# : CreateInterface */;", "public function __construct(){\n $this->api = new Concierge();\n }", "public function getApi();", "public function getApi();", "public function getApi();" ]
[ "0.6499728", "0.62105834", "0.60508", "0.5871631", "0.5857463", "0.57444525", "0.5723107", "0.5674913", "0.56539774", "0.555263", "0.5550741", "0.55499077", "0.5504947", "0.54936004", "0.5485003", "0.5468451", "0.5464812", "0.5438502", "0.54377526", "0.54197794", "0.5410646", "0.5398144", "0.5346281", "0.5339376", "0.5338785", "0.5333747", "0.5316531", "0.5283537", "0.5283537", "0.5283537" ]
0.7473338
0
Get interface from LAS_API
function las_get_interface($name = null) { global $LAS_CFG, $LAS_API; $las_api = $LAS_CFG->wwwroot . '/api'; $report_api = $LAS_CFG->wwwroot . '/report'; las_add_interface( 'GetAPIs', $las_api . '/GetAPIs', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); las_add_interface( 'UploadFile', $las_api . '/UploadFile', LAS_API_MSGTYPE_FILE, LAS_API_MSGTYPE_JSON ); las_add_interface( 'GetResult', $las_api . '/GetResult', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); las_add_interface( 'GetReportUrl', $report_api . '/GetReportUrl', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); $GLOBALS['LAS_API'] = $LAS_API; if ( !empty($name) ) { if ( array_key_exists($name, $LAS_API) ) { return $LAS_API[$name]->url; } } else { return json_encode($LAS_API); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getInterface();", "public function getInterface()\n {\n return $this->interface;\n }", "public function getApi();", "public function getApi();", "public function getApi();", "function las_add_interface($name, $url, $msgtype='json', $rettype='json') {\n\tglobal $LAS_API;\n\n\tif ( $name && $url && $msgtype ) {\n\t\t$entry = new stdClass;\n\n\t\t$entry->url = $url;\n\t\t$entry->msgtype = $msgtype;\n\t\t$entry->rettype = $rettype;\n\n\t\t$LAS_API[$name] = $entry;\n\t}\n}", "function get_application_interface($id)\n{\n global $airavataclient;\n $applicationInterface = null;\n\n try\n {\n $applicationInterface = $airavataclient->getApplicationInterface($id);\n }\n catch (InvalidRequestException $ire)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>InvalidRequestException: ' . $ire->getMessage(). '</p>');\n }\n catch (AiravataClientException $ace)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');\n }\n catch (AiravataSystemException $ase)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');\n }\n\n return $applicationInterface;\n}", "static public function getInterfaces();", "public function getInterfaces() {}", "public function getIface() {\n \n return $this->iface;\n \n }", "public function getApi()\r\n {\r\n return Mage::getSingleton('firstdatae4/api_nvp');\r\n }", "public function getLibraryInterface(): string\n {\n return <<<C\n typedef struct {\n const char* content;\n uint32_t len;\n } tc_string_data_t;\n\n typedef struct {\n } tc_string_handle_t;\n \n typedef void (*tc_response_handler_t)(\n uint32_t request_id,\n tc_string_data_t params_json,\n uint32_t response_type,\n bool finished);\n\n tc_string_data_t tc_read_string(const tc_string_handle_t* string);\n void tc_destroy_string(const tc_string_handle_t* string);\n \n tc_string_handle_t* tc_create_context(tc_string_data_t config);\n void tc_destroy_context(uint32_t context);\n\n void tc_request(\n uint32_t context,\n tc_string_data_t function_name,\n tc_string_data_t function_params_json,\n uint32_t request_id,\n tc_response_handler_t response_handler);\n C;\n }", "public function getApi()\n {\n return Mage::getSingleton('paystation/api_nvp');\n }", "public function getInterfaceCode();", "public function getApiBase();", "public static function getUserAPI();", "public function extractApi();", "public function getInterfaceText();", "public function getInterfaceUri()\n {\n if (static::$isDebug == 1) {\n return 'http://test.show.wepiao.com/api/';\n } elseif(static::$isDebug == 2) {\n return 'http://web.show.wepiao.com/api/';\n }elseif(static::$isDebug == 3) {\n return 'http://www.wepiao.com/api/';\n }\n }", "public function getUserInterface() {\r\n\t\treturn $this->interface;\r\n\t}", "public function get_interface_boot_protocol($interface_obj)\r\n\t{\r\n\t}", "public function getAPI()\n {\n return $this->api;\n }", "public function getHeaderTargetAPI()\r\n\t{\r\n\t\treturn $this->headers[SONIC_HEADER__TARGET_API];\r\n\t}", "public function getApiService();", "public abstract function getApiObjectClass();", "public function getInterface()\n {\n return $this->predis;\n }", "private function requestBridgeInfo() {\n $conn = new ApiConnection;\n $result = $conn->sendGetCmd(\"config\");\n return $result;\n }", "public static function api() {\n return Injector::inst()->get(self::APIServiceName);\n }", "function apiai()\n {\n $this->name = \"apiai\";\n $this->title = \"API.AI\";\n $this->module_category = \"<#LANG_SECTION_OBJECTS#>\";\n $this->api_endpoint = \"https://api.dialogflow.com/v1/\";\n $this->api_version = \"20170712\";\n $this->checkInstalled();\n }", "public function setApi(ApiInterface $api);" ]
[ "0.7175563", "0.62512624", "0.6231569", "0.6231569", "0.6231569", "0.5970218", "0.5890664", "0.5888556", "0.5847565", "0.58154094", "0.5804445", "0.5797872", "0.5750256", "0.57447606", "0.5722948", "0.56863195", "0.5651915", "0.5639321", "0.56219655", "0.56097263", "0.5604869", "0.56030786", "0.5554486", "0.5550464", "0.55252457", "0.55103046", "0.5502532", "0.5447041", "0.54456", "0.544229" ]
0.7418081
0
Complete final URL, simply concatenate strings from three given sources: `$urlBaseSection` Begin URL part containing http, domain and base path like: ` `$urlPathWithQuerySection` Subject url part with application path and possible query string: `/some/path?with=query` `$systemParams` Array to implode it's values into string with system params like media site version or localization: `['media_version' => 'm', 'localization' => 'enUS']` Example output: `
protected function urlByRoutePrefixSystemParams ($urlBaseSection, $urlPathWithQuerySection, array $systemParams = [], $urlPathWithQueryIsHome = NULL) { // complete prefixes section from system params $urlPrefixesSection = trim(implode('/', array_values($systemParams)), '/'); $urlPrefixesSectionHasValue = $urlPrefixesSection !== ''; if ($urlPrefixesSectionHasValue) { $urlPrefixesSection = '/' . $urlPrefixesSection; // finalizing possible trailing slash after prefix if any prefix if ($this->trailingSlashBehaviour === \MvcCore\IRouter::TRAILING_SLASH_REMOVE) { if ($urlPathWithQueryIsHome === NULL) $urlPathWithQueryIsHome = $this->urlIsHomePath($urlPathWithQuerySection); if ($urlPathWithQueryIsHome) $urlPathWithQuerySection = ltrim($urlPathWithQuerySection, '/'); } } return $urlBaseSection . $urlPrefixesSection . $urlPathWithQuerySection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toString(): string\n\t{\n\t\t$url = $this->base();\n\t\t$slash = true;\n\n\t\tif (empty($url) === true) {\n\t\t\t$url = '/';\n\t\t\t$slash = false;\n\t\t}\n\n\t\t$path = $this->path->toString($slash) . $this->params->toString(true);\n\n\t\tif ($this->slash && $slash === true) {\n\t\t\t$path .= '/';\n\t\t}\n\n\t\t$url .= $path;\n\t\t$url .= $this->query->toString(true);\n\n\t\tif (empty($this->fragment) === false) {\n\t\t\t$url .= '#' . $this->fragment;\n\t\t}\n\n\t\treturn $url;\n\t}", "function build_url($base_url, $params) {\r\n $url = $base_url;\r\n if (!empty($params)) {\r\n $url .= '?' . implode('&', $params);\r\n }\r\n return $url;\r\n }", "function url_build(string $base, string $params = ''): string\n{\n if ($params) {\n $params = ((false === strpos($base, '?')) ? '?' : '&') . $params;\n }\n return \\get_site_url() . '/' . $base . $params;\n}", "static public function http_build_str(array $url_components, $relative = TRUE)\n {\n $url = '';\n\n if ( ! $relative)\n {\n if (($scheme = arr::get($url_components, 'scheme')) != NULL)\n {\n $url .= $scheme.'://';\n }\n\n if (($host = arr::get($url_components, 'host')) != NULL)\n {\n $url .= $host;\n }\n }\n\n if (($path = arr::get($url_components, 'path')) != NULL)\n {\n $url .= $path;\n }\n\n if (($query = arr::get($url_components, 'query')) != NULL)\n {\n $url .= '?'.$query;\n }\n\n if (($fragment = arr::get($url_components, 'fragment')) != NULL)\n {\n $url .= '#'.$fragment;\n }\n\n return $url;\n }", "function elgg_http_build_url(array $parts) {\n\t// build only what's given to us.\n\t$scheme = isset($parts['scheme']) ? \"{$parts['scheme']}://\" : '';\n\t$host = isset($parts['host']) ? \"{$parts['host']}\" : '';\n\t$port = isset($parts['port']) ? \":{$parts['port']}\" : '';\n\t$path = isset($parts['path']) ? \"{$parts['path']}\" : '';\n\t$query = isset($parts['query']) ? \"?{$parts['query']}\" : '';\n\n\t$string = $scheme . $host . $port . $path . $query;\n\n\treturn $string;\n}", "private function _combineUrl()\n {\n $args = func_get_args();\n $url = '';\n foreach ($args as $arg) {\n if (!is_string($arg)) {\n continue;\n }\n if ($arg[strlen($arg) - 1] !== '/') {\n $arg .= '/';\n }\n $url .= $arg;\n }\n\n return $url;\n }", "private function build_url($endpoint, array $query = array())\n {\n $url = $this->base_url.$endpoint;\n\n if (!empty($query)) {\n $url .= '?'.http_build_query($query);\n }\n\n return $url;\n }", "function build_url($base,$url) {\n $base_parts=url_parts($base);\n\n # https://code.google.com/p/add-mvc-framework/issues/detail?id=81\n if (preg_match('/^javascript\\:/',$url)) {\n return $url;\n }\n\n if ($url[0]==='/') {\n return rtrim($base_parts['protocol_domain'],'/').$url;\n }\n if ($url[0]==='?') {\n if (!$base_parts['pathname'])\n $base_parts['pathname']='/';\n return $base_parts['protocol_domain'].$base_parts['pathname'].$url;\n }\n if ($url[0]==='#') {\n\n }\n if (preg_match('/^https?\\:\\/+/',$url)) {\n return $url;\n }\n\n return rtrim($base_parts['protocol_domain'],\"/\").$base_parts['path'].$url;\n}", "private function _buildUri(): string {\n return !empty($this->query) ? $this->uri.'?'.http_build_query($this->query) : $this->uri;\n }", "public static function buildUrl($params)\n {\n /** @var HttpRequestInterface $request */\n $request = self::fetchComponent(HttpRequestInterface::class);\n if ($request) {\n $data = isset($params['data']) ? $params['data'] : [];\n $query = $request->getQueryArray();\n foreach ($data as $key => $value) {\n $query[$key] = $value;\n }\n return $request->getPath() . '?' . http_build_query($query);\n }\n return \"\";\n }", "function http_build_url($url = null, $parts = null, $flags = null, ?array &$new_url = null) {}", "public function url()\r\n {\r\n return $this->get_base_url() . http_build_query($this->get_query_params());\r\n }", "protected function generateString()\n\t{\n\t\t// start with the scheme\n\t\t$url = $this->scheme . '://';\n\t\t\n\t\t// user and password\n\t\tif( !empty( $this->user ) )\n\t\t{\n\t\t\t$url .= $this->user;\n\t\t\tif( !empty( $this->pass ) ) $url .= ':'.$this->pass.'@';\n\t\t\telse $url .= '@';\n\t\t}\n\t\t\n\t\t// add the host and path\n\t\t$url .= $this->host . '/';\n\t\t$url .= $this->path;\n\t\t\n\t\t// add the URL-encoded parameters\n\t\tif( !empty( $this->params ) )\n\t\t{\n\t\t\t$url .= '?';\n\t\t\tforeach( $this->params as $f => $v ) $url .= $f . '=' . urlencode( $v ) . '&';\n\t\t\t$url = rtrim( $url, '&' );\n\t\t}\n\t\t\n\t\t// add the anchor if any\n\t\tif( !empty( $this->anchor ) ) $url .= '#' . $this->anchor;\n\t\t\n\t\t$this->url = $url;\n\t\t$this->modified = false;\n\t\treturn $url;\n\t}", "public function getFullUrl(){\n return 'http://'. $_SERVER['HTTP_HOST'] .'/'. implode('/', self::$_request_vars);\n }", "function _http_build_url($parts) { \n return implode(\"\", array(\n isset($parts['scheme']) ? $parts['scheme'] . '://' : '',\n isset($parts['user']) ? $parts['user'] : '',\n isset($parts['pass']) ? ':' . $parts['pass'] : '',\n (isset($parts['user']) || isset($parts['pass'])) ? \"@\" : '',\n isset($parts['host']) ? $parts['host'] : '',\n isset($parts['port']) ? ':' . intval($parts['port']) : '',\n isset($parts['path']) ? $parts['path'] : '',\n isset($parts['query']) ? '?' . $parts['query'] : '',\n isset($parts['fragment']) ? '#' . $parts['fragment'] : ''\n ));\n}", "public function url()\n {\n if (empty($this->parameters)) {\n return $this->url;\n }\n $total = array();\n foreach ($this->parameters as $k => $v) {\n if (is_array($v)) {\n foreach ($v as $va) {\n $total[] = HttpClient::urlencodeRFC3986($k).\"[]=\".HttpClient::urlencodeRFC3986($va);\n }\n } else {\n $total[] = HttpClient::urlencodeRFC3986($k).\"=\".HttpClient::urlencodeRFC3986($v);\n }\n }\n $out = implode(\"&\", $total);\n\n return $this->url.'?'.$out;\n }", "function buildUrl($section = null, string $action = null, string $id = null, string $csrfToken = null): string\n{\n global $config, $site;\n\n if (! is_array($section)) {\n $array['section'] = $section;\n $array['action'] = $action;\n $array['id'] = $id;\n $array['csrftoken'] = $csrfToken;\n $section = $array;\n }\n\n $queryStr = \"\";\n foreach ($section as $key => $value) {\n if ($value !== null) {\n if ($key === 'section' && strpos($value, 'admin') === 0) {\n $value = str_replace('admin', $config['admin_section_name'], $value);\n\n if ($value === $config['admin_section_name']) {\n // no page specified\n $value .= \":users\";\n }\n }\n $queryStr .= \"$key=$value&\";\n }\n }\n\n if (\n (! isset($section['csrfToken']) || $section['csrfToken'] === null) &&\n $config[\"use_url_rewrite\"]\n ) {\n $queryStr = str_replace(\"&\", \"\", $queryStr);\n $queryStr = str_replace([\"section=\", \"action=\", \"id=\"], \"/\", $queryStr);\n $queryStr = ltrim($queryStr, \"/\");\n } else {\n if ($queryStr !== \"\") {\n $queryStr = \"?\" . rtrim($queryStr, \"&\");\n }\n $queryStr = \"index.php\" . $queryStr;\n }\n\n return $site['directory'] . $queryStr;\n}", "protected function _build_url() {\n\n $params = array_filter([\n 'name' => $this->_names,\n 'country_id' => $this->_country_id,\n 'language_id' => $this->_language_id,\n ], function($v) {\n if (!is_array($v)) {\n return strlen(trim($v)) > 0;\n } else {\n return $v;\n }\n });\n //Only pass apikey if there is one set\n if ($api_key = $this->get_api_key()) {\n $params['apikey'] = trim($api_key);\n }\n\n return self::BASE . '?' . http_build_query($params);\n }", "private function buildQueryString(){\n if(count($this->querystrings) == 0){\n return \"\";\n }\n else{\n $querystring = \"?\";\n\n foreach($this->querystrings as $index => $value){\n if($index > 0){\n $querystring .= \"&\";\n }\n $querystring .= $value;\n }\n\n return $querystring;\n }\n }", "abstract protected function buildSpecificRequestUri();", "private function _buildUrl() {\n $url = OPENDIGI_API_ENDPOINT;\n $url .= '?Vcollection=' . implode('+', $this->_collections);\n if ($this->_languages)\n $url .= '&Vlanguages=' . implode('+', $this->_languages);\n if ($this->_subjectIds)\n $url .= '&Vsubjectids=' . implode('+', $this->_subjectIds);\n\n return $url;\n }", "protected function getUrl($section, array $uriParams = [])\n {\n return parent::getUrl(sprintf(\"api.%s/%s\", $section, $this->apiKey), $uriParams);\n }", "private function getParamsUrlFormat() {\n $urlParams = \"\";\n\n if ($this->getMethod() == 'GET') {\n $urlParams .= ($this->getPaging()) ? \n \"?_paging=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_return_as_object=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_max_results=\" . $this->getMaxResults() : \n \"\";\n }\n\n if ($this->getMethod() == 'POST') {\n $function = $this->getFuction();\n $urlParams .= (isset($function) and $function != \"\") ?\n \"?_function=\" . $this->getFuction() :\n \"\";\n }\n\n return $urlParams;\n }", "function buildUrl($parts=array()){\r\n\t$uparts=array();\r\n\tforeach($parts as $key=>$val){\r\n\t\tif(preg_match('/^(PHPSESSID|GUID|debug|error|username|password|add_result|domain_href|add_id|add_table|edit_result|edit_id|edit_table|)$/i',$key)){continue;}\r\n\t\tif(preg_match('/^\\_(login|pwe|try|formfields|action|view|formname|enctype|fields|csuid|csoot)$/i',$key)){continue;}\r\n\t\tif(!is_string($val) && !isNum($val)){continue;}\r\n\t\tif(!strlen(trim($val))){continue;}\r\n\t\tif($val=='Array'){continue;}\r\n\t\tarray_push($uparts,\"$key=\" . encodeURL($val));\r\n \t}\r\n $url=implode('&',$uparts);\r\n return $url;\r\n\t}", "public function buildUrlQueryString( $url = null, array $paramsToUpdate = array(), $anchor = null )\n {\n $url = ( $url === null ) ? OW_URL_HOME . $this->getRequestUri() : trim($url);\n\n $requestUrlArray = parse_url($url);\n\n $currentParams = array();\n\n if ( isset($requestUrlArray['query']) )\n {\n parse_str($requestUrlArray['query'], $currentParams);\n }\n\n $currentParams = array_merge($currentParams, $paramsToUpdate);\n\n $scheme = empty($requestUrlArray[\"scheme\"]) ? \"\" : $requestUrlArray[\"scheme\"] . \":\";\n $host = empty($requestUrlArray[\"host\"]) ? \"\" : \"//\" . $requestUrlArray[\"host\"];\n $port = empty($requestUrlArray[\"port\"]) ? \"\" : \":\" . (int) $requestUrlArray[\"port\"];\n $path = empty($requestUrlArray[\"path\"]) ? \"\" : $requestUrlArray[\"path\"];\n $queryString = empty($currentParams) ? \"\" : \"?\" . http_build_query($currentParams);\n $anchor = ($anchor === null) ? \"\" : \"#\" . trim($anchor);\n\n return $scheme . $host . $port . $path . $queryString . $anchor;\n }", "private function generate_url($params) {\n $s = ($_SERVER['HTTPS'] == 'on') ? 's' : '';\n $protocol = $this->strleft(strtolower($_SERVER['SERVER_PROTOCOL']), '/') . $s;\n $port = (($_SERVER['SERVER_PORT'] == '80' && $_SERVER['HTTPS'] != 'on') ||\n ($_SERVER['SERVER_PORT'] == '443' && $_SERVER['HTTPS'] == 'on')) ? \n '' : (':' .$_SERVER['SERVER_PORT']);\n $path = $this->strleft($_SERVER['REQUEST_URI'], '?');\n $parsed_params = '';\n $delm = '?';\n foreach (array_reverse($params) as $key => $val) {\n if (!empty($val)) {\n $parsed_key = $key[0] == '_' ? $key : '_' . $key;\n $parsed_params .= $delm . urlencode($parsed_key) . '=' . urlencode($val);\n $delm = '&';\n }\n }\n $cfg = rcmail::get_instance()->config->all();\n if ( $cfg['cas_webmail_server_name'] ) {\n $serverName = $cfg['cas_webmail_server_name'];\n } else {\n $serverName=$_SERVER['SERVER_NAME'];\n }\n return $protocol . '://' . $serverName . $port . $path . $parsed_params;\n }", "protected function addToCurrentUrl($arrParams)\r\n\t{\r\n\t\t$strUrl = $this->Environment->request;\r\n\t\t\r\n\t\tforeach($arrParams as $arrParam)\r\n\t\t{\r\n\t\t\t$strUrl .= (strpos($strUrl, '?') !== false) ? '&' : '?';\t\r\n\t\t\t$strUrl .= $arrParam[0] . '=' . $arrParam[1];\r\n\t\t}\r\n\t\t\r\n\t\treturn $strUrl;\r\n\t}", "public function formatLink(Url $url) {\n $query = $url->getQuery();\n $url->setQuery(array());\n\n // extract path to separate params and remove actions\n $parts = explode(self::REWRITE_PARAM_TO_ACTION_DELIMITER, $url->getPath());\n\n foreach ($parts as $part) {\n\n // only extract \"normal\" parameters, avoid actions\n if (strpos($part, '-action') === false) {\n\n $paths = explode('/', strip_tags($part));\n array_shift($paths);\n\n // create key => value pairs from the current request\n $x = 0;\n while ($x <= (count($paths) - 1)) {\n\n if (isset($paths[$x + 1])) {\n $url->setQueryParameter($paths[$x], $paths[$x + 1]);\n }\n\n // increment by 2, because the next offset is the key!\n $x = $x + 2;\n }\n }\n }\n\n // reset the path to not have duplicate path due to generic param generation\n $url->setPath(null);\n\n // merge query now to overwrite values already contained in the url\n $url->mergeQuery($query);\n\n $resultUrl = $this->getFormattedBaseUrl($url);\n\n $path = $url->getPath();\n if (!empty($path)) {\n $resultUrl .= $path;\n }\n\n $query = $url->getQuery();\n if (count($query) > 0) {\n foreach ($query as $name => $value) {\n // allow empty params that are action definitions to not\n // exclude actions with no params!\n if (!empty($value) || (empty($value) && strpos($name, '-action') !== false)) {\n if (strpos($name, '-action') === false) {\n $resultUrl .= '/' . $name . '/' . $value;\n } else {\n // action blocks must be separated with group indicator\n // to be able to parse the parameters\n $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $name . '/' . $value;\n }\n }\n }\n }\n\n // add fc actions\n $actions = $this->getActionsUrlRepresentation(true);\n if (!empty($actions)) {\n $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $actions;\n }\n\n return $resultUrl;\n }", "protected function prepareUrl()\n {\n $address = rtrim($this->config['url'], '/');\n\n if (substr_compare($address, static::API_PATH, -strlen(static::API_PATH)) !== 0) {\n $address .= static::API_PATH;\n }\n\n return $address;\n }", "public function composeUri($params)\n {\n $ret = '';\n $first = true;\n\n foreach ($params as $param => $values) {\n if (!$first) {\n $ret .= $this->seperators['param'];\n }\n $first = false;\n $internal = $param;\n if ($external = $this->translateKeyOutput($param)) {\n $param = $external;\n }\n $ret .= $param . $this->seperators['key_value'];\n $firstValue = true;\n foreach ($values as $value) {\n if ($external = $this->translateValueOutput($internal, $value)) {\n $value = $external;\n }\n if (!$firstValue) {\n $ret .= $this->seperators['value'];\n } else {\n $firstValue = false;\n }\n $ret .= urlencode($value);\n }\n }\n\n return $ret;\n }" ]
[ "0.6093951", "0.6050948", "0.59143114", "0.57995987", "0.566326", "0.5639802", "0.56183654", "0.56003124", "0.55905324", "0.5583229", "0.55726826", "0.5559579", "0.55568993", "0.55234265", "0.5523188", "0.5499795", "0.5465034", "0.54419494", "0.5425271", "0.5397729", "0.53547597", "0.53538585", "0.5339727", "0.53184974", "0.53011507", "0.52954", "0.52858114", "0.52715707", "0.5271007", "0.5268378" ]
0.6669317
0
echo getMaxSumSubSequence($arr, 0, 5); The following algorithm solves the problem with time complexity O(N^3) and it's not so efficient because it computes partial sums many times.
function getSubseqSum( $arr ) { $N = count($arr) - 1; $bestSum = 0; $posBest = -1; for($i = 0; $i <= $N; $i++) { for($j = $N; $j >= $i; $j--) { $partialSum = 0; for($k = $i; $k <= $j; $k++) { $partialSum += $arr[ $k ]; } if($partialSum > $bestSum) { $bestSum = $partialSum; } } } return $bestSum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubseqMaxSum( $arr ) {\n\n //firstly we determine the number of the elements\n $N = count($arr) - 1;\n\n $sumMax = -999;\n\n $iMax = -1; $jMax = -1; \n\n //for i = 0 to N execute\n for($i = 0; $i <= $N; $i++) {\n\n $sum = 0;\n\n for($j = $i;$j <= $N; $j++) {\n\n $sum = $sum + $arr[ $j ]; \n\n if($sum > $sumMax) {\n\n $sumMax = $sum;\n $iMax = $i;\n $jMax = $j;\n }\n\n }\n\n } \n\n return array(\"sumMax\"=>$sumMax, \n \"i\"=>$iMax,\n \"j\"=>$jMax);\n}", "function getMaxSumSubSequence($arr, $li, $ls) {\n\n if($li == $ls) return $arr[ $li ];\n\n $middle = intval(($li+$ls)/2);\n\n\n $bestL = getMaxSumSubSequence($arr, $li, $middle);\n $bestR = getMaxSumSubSequence($arr, $middle+1,$ls);\n\n $maxSuf = -9999; \n $maxPre = -9999;\n\n $suf = 0;\n for($i = $middle;$i >= $li; $i--) {\n\n $suf += $arr[$i]; \n\n if($suf > $maxSuf) {\n $maxSuf = $suf;\n } \n } \n\n $pre = 0;\n for($j = $middle+1;$j <= $ls; $j++) {\n\n $pre += $arr[$j];\n\n if($pre > $maxPre) {\n $maxPre = $pre;\n }\n } \n\n\n return max($bestL, max($bestR, ($maxSuf + $maxPre) )); \n}", "function getSumSeq( $arr ) {\n\n $N = count($arr) - 1;\n \n $sum = array();\n\n $sum[ 0 ] = $arr[ 0 ];\n\n for($i = 1; $i <= $N; $i++) {\n\n $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; \n } \n\n $bestSum = 0;\n\n $best = array();\n\n $best[ 0 ] = $sum[ 0 ];\n\n $min = $sum[ 0 ];\n \n for($i = 1; $i <= $N; $i++) {\n\n $best[ $i ] = $sum[ $i ] - $min;\n\n if($sum[ $i ] < $min) {\n\n $min = $sum[ $i ];\n } \n\n if($bestSum < $best[ $i ]) {\n\n $bestSum = $best[ $i ]; \n $pos = $i;\n }\n } \n\n return array(\"bestsum\"=>$bestSum, \n \"pos\"=>$pos);\n}", "function miniMaxSum($arr) {\n\t$sum = [];\n\n\tfor($i = 0; $i < 5; $i++)\n\t{\n\t\t$tempArray = $arr;\n\t\tunset($tempArray[$i]);\n\t\t$sum[] = array_sum($tempArray);\n\t}\n\tprint min($sum).\" \".max($sum);\n}", "function miniMaxSum($arr) {\n $allSums = [];\n for ($i = 0; $i < count($arr); $i++) {\n $tmpArray = $arr;\n unset($tmpArray[$i]);\n $allSums[] = array_sum($tmpArray);\n }\n\n print min($allSums) . ' ' . max($allSums);\n}", "function miniMaxSum($arr) {\n // Write your code here\n sort($arr);\n $total = array_sum($arr);\n $newsum = []; \n for ($i = 0; $i < count($arr); $i++) {\n $newsum[] = $total-$arr[$i];\n }\n $min = min($newsum);\n $max = max($newsum);\n \n echo $min.' '.$max;\n\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function miniMaxSum(array $arr)\n{\n $sum = array_sum($arr);\n printf(\"%d %d\", $sum - max($arr), $sum - min($arr));\n}", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function solution($N, $A) {\n $counters = array_fill(1, $N, 0);\n $currentMax = 0;\n foreach ($A as $v) {\n if ($v >= 1 && $v <= $N) {\n $counters[$v] += 1;\n if ($counters[$v] > $currentMax) {\n $currentMax = $counters[$v];\n }\n }\n else if ($v === ($N + 1)) {\n $counters = array_fill(1, $N, $currentMax);\n }\n }\n return array_values($counters);\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function findMax($arr, $n) \n{ \n\t$mi = 0; \n\tfor ($i = 0; $i < $n; ++$i) \n\t\tif ($arr[$i] > $arr[$mi]) \n\t\t\t\t$mi = $i; \n\treturn $mi; \n}", "function migratoryBirds($arr)\n{\n $countArray = [];\n for ($i = 5; $i >= 1; $i--) {\n $countArray[$i] = 0;\n }\n for ($i = 0; $i < count($arr); $i++) {\n $countArray[$arr[$i]]++;\n }\n\n $max = 5;\n for ($i = 5; $i >= 1; $i--) {\n if ($countArray[$max] <= $countArray[$i]) {\n $max = $i;\n }\n }\n return $max;\n}", "function solution($N) {\n $binStr = decbin($N);\n $binStr = preg_replace(['/^0+/', '/0+$/'], '',$binStr);\n $zeros = explode('1', $binStr);\n $zeros = array_map(function ($zero) {\n return strlen($zero);\n }, $zeros);\n return max($zeros);\n}", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "function euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "function arrayManipulation($number, $queries) {\n\n $array=[];\n for ($index = 0; $index < count($queries); $index++)\n {\n $array[$queries[$index][0]-1]=0;\n $array[$queries[$index][1]]=0;\n }\n for ($index = 0; $index < count($queries); $index++)\n {\n $a= $queries[$index][0];\n $b= $queries[$index][1];\n $k= $queries[$index][2];\n $array[$a-1] += $k;\n $array[$b] -= $k;\n }\n\n $sum=0;\n $max=0;\n for ($index = 0; $index < $number; $index++)\n {\n @$sum += $array[$index];\n if ($sum > $max)\n $max = $sum;\n }\n return $max;\n}", "function sum_of_3_and_5() {\n\n /*\n * Algorithmic solution\n * count of multiples of 3 = 1000 / 3 = 333;\n * count of multiples of 5 = 1000 / 5 = 199;\n *\n * sum of multiplies of 3\n * 1 * 3 + 2 * 3 + ... + 333 * 3 = 3 * (1 + ... + 333) = 3 * 333 * (333 + 1) / 2\n * sum of multiplies of 5\n * 1 * 5 + 2 * 5 + ... + 199 * 5 = 5 * (1 + ... + 199) = 5 * 199 * (199 + 1) / 2\n *\n * sum = 166833 + 99500 = 266333\n *\n */\n\n $sum = 0;\n for($i = 3; $i < 1000; $i += 3) {\n $sum += $i;\n }\n\n for($i = 5; $i < 1000; $i += 5) {\n $sum += $i;\n }\n\n return $sum; // 266333\n}", "function findSubsquare($inputs) {\n for ($i = count($inputs); $i > 0; $i --) {\n $ans = findSubsquareOfSize($inputs, $i);\n if ($ans) return $ans;\n }\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "public function GetMaxSumWithoutAdjacent($input) {\n\t\t$length = count($input);\n\t\t$sumEvens = $sumOdds = 0;\n\t\t\n\t\tfor ($i=0 ; $i < $length; $i = $i+2) { \n\t\t\t$sumEvens += $input[$i];\n\t\t\tisset($input[$i+1]) && $sumOdds += $input[$i+1];\n\t\t}\n\n\t\techo $sumEvens > $sumOdds ? $sumEvens : $sumOdds;\n\t}", "function getSequenceSum($i, $j, $k) {\n $tmp = 0;\n for ($i; $i < $j; $i++) {\n $tmp += $i;\n }\n for ($k; $k < $j; $k++) {\n $tmp += $k;\n }\n return $tmp + $j;\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function solution($A) {\n // write your code in PHP7.0\n $idxes = [];\n $C = [];\n $L = count($A);\n $mid = floor($L/2);\n\n foreach ($A as $k=>$v) {\n if (!isset($C[$v])) {\n $idxes[$v] = [];\n $C[$v] = 0;\n }\n\n $C[$v] += 1;\n array_push($idxes[$v], $k);\n\n if ($C[$v] > $mid) {\n $rIdx = $v;\n }\n }\n\n // No leader\n if (!isset($rIdx)) {\n return 0;\n }\n \n $leaderIndexes = $idxes[$rIdx];\n // print_r($leaderIndexes);\n $leaderTotal = count($leaderIndexes);\n $eCount = 0;\n for ($i = 0; $i < $leaderTotal; $i++) {\n $leaderIndex = $leaderIndexes[$i];\n $taCount = $leaderIndex + 1;\n \n $taMid = floor($taCount / 2);\n // $i + 1 is the count of leaders so far\n if ($i+1 > $taMid){\n $tbCount = $L - $taCount;\n $leftLeaders = $leaderTotal - ($i + 1); \n // print \"\\$i: $i, \\$leaderIndex: $leaderIndex, \\$taCount: $taCount, \\$tbCount: $tbCount, \\$leftLeaders: $leftLeaders \\r\\n\";\n if ($leftLeaders > floor($tbCount / 2)) {\n $eCount++;\n }\n\n // borrow from left for list like [4, 4, 2, 5, 3, 4, 4, 4];\n if ($i + 1 > floor(($taCount + 1) / 2) && $i+1 < $leaderTotal && $leaderIndexes[$i+1] != $leaderIndexes[$i] + 1 && $leftLeaders > floor(($tbCount - 1) / 2)) {\n $eCount++;\n }\n } \n }\n\n return $eCount;\n}" ]
[ "0.8041444", "0.77919126", "0.73802394", "0.7115275", "0.6726554", "0.65194285", "0.6506421", "0.6403983", "0.64031935", "0.62988573", "0.6288922", "0.6204386", "0.6123467", "0.61165744", "0.6093035", "0.60909206", "0.60499895", "0.60432196", "0.590041", "0.5755475", "0.5734296", "0.56906873", "0.5687612", "0.56859016", "0.562443", "0.56191325", "0.55714816", "0.5566385", "0.55499816", "0.54908085" ]
0.8347308
0
This algorithm solve the problem with linear O(N) time complexity using Dynamic Programming best[i] = sum[i] min(sum[j1])
function getSumSeq( $arr ) { $N = count($arr) - 1; $sum = array(); $sum[ 0 ] = $arr[ 0 ]; for($i = 1; $i <= $N; $i++) { $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; } $bestSum = 0; $best = array(); $best[ 0 ] = $sum[ 0 ]; $min = $sum[ 0 ]; for($i = 1; $i <= $N; $i++) { $best[ $i ] = $sum[ $i ] - $min; if($sum[ $i ] < $min) { $min = $sum[ $i ]; } if($bestSum < $best[ $i ]) { $bestSum = $best[ $i ]; $pos = $i; } } return array("bestsum"=>$bestSum, "pos"=>$pos); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubseqSum( $arr ) {\n\n $N = count($arr) - 1;\n\n $bestSum = 0;\n\n $posBest = -1;\n\n for($i = 0; $i <= $N; $i++) {\n\n for($j = $N; $j >= $i; $j--) {\n\n $partialSum = 0;\n\n for($k = $i; $k <= $j; $k++) {\n\n $partialSum += $arr[ $k ]; \n }\n\n if($partialSum > $bestSum) {\n\n $bestSum = $partialSum;\n } \n } \n }\n\n return $bestSum;\n}", "function absoluteValuesSumMinimization($a) {\n $all_sum = [];\n for($i = 0; $i < count($a); $i++){\n $sum = 0;\n for($j = 0; $j < count($a); $j++){\n $sum += abs($a[$j] - $a[$i]);\n }\n $all_sum[$a[$i]] = $sum;\n }\n return array_search(min($all_sum), $all_sum);\n}", "function miniMaxSum($arr) {\n $allSums = [];\n for ($i = 0; $i < count($arr); $i++) {\n $tmpArray = $arr;\n unset($tmpArray[$i]);\n $allSums[] = array_sum($tmpArray);\n }\n\n print min($allSums) . ' ' . max($allSums);\n}", "function miniMaxSum($arr) {\n\t$sum = [];\n\n\tfor($i = 0; $i < 5; $i++)\n\t{\n\t\t$tempArray = $arr;\n\t\tunset($tempArray[$i]);\n\t\t$sum[] = array_sum($tempArray);\n\t}\n\tprint min($sum).\" \".max($sum);\n}", "function miniMaxSum($arr) {\n // Write your code here\n sort($arr);\n $total = array_sum($arr);\n $newsum = []; \n for ($i = 0; $i < count($arr); $i++) {\n $newsum[] = $total-$arr[$i];\n }\n $min = min($newsum);\n $max = max($newsum);\n \n echo $min.' '.$max;\n\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function getSubseqMaxSum( $arr ) {\n\n //firstly we determine the number of the elements\n $N = count($arr) - 1;\n\n $sumMax = -999;\n\n $iMax = -1; $jMax = -1; \n\n //for i = 0 to N execute\n for($i = 0; $i <= $N; $i++) {\n\n $sum = 0;\n\n for($j = $i;$j <= $N; $j++) {\n\n $sum = $sum + $arr[ $j ]; \n\n if($sum > $sumMax) {\n\n $sumMax = $sum;\n $iMax = $i;\n $jMax = $j;\n }\n\n }\n\n } \n\n return array(\"sumMax\"=>$sumMax, \n \"i\"=>$iMax,\n \"j\"=>$jMax);\n}", "function indexMinSum($arr, $n)\n{\n\t// Initialization of the\n\t// min value\n\t$min = $arr[0];\n\t$index = 0;\n\n\t// Find minimum element in\n\t// the array\n\tfor ($i = 1; $i < $n; $i++)\n\t{\n\t\tif ($arr[$i] < $min)\n\t\t{\n\n\t\t\t// store the index of the\n\t\t\t// current minimum element\n\t\t\t$min = $arr[$i];\n\t\t\t$index = $i;\n\t\t}\n\t}\n\n\t// return the index of min\n\t// element 1-based index\n\treturn ($index + 1);\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function sapXep($arr){\n for ($i = 0; $i < count($arr) - 1; $i ++){\n // Tim vi tri min\n $min = $i;\n for ($j = $i +1; $j < count($arr); $j ++){\n if ($arr[$j] < $arr[$min]){\n $min = $j;\n }\n }\n //sau khi co vi tri nho nhat thi doi vi tri voi $i\n $temp = $arr[$i];\n $arr[$i] = $arr[$min];\n $arr[$min] = $temp;\n\n }\n return $arr;\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function bestTimeToBuyAndSellStock($arr) {\n $len = count($arr);\n $minPrice = 999;\n $maxPro = 0;\n for ($i=0; $i<$len; $i++) {\n $minPrice = min($minPrice, $arr[$i]);\n $maxPro = max($maxPro, $arr[$i] - $minPrice);\n }\n return $maxPro;\n}", "function miniMaxSum(array $arr)\n{\n $sum = array_sum($arr);\n printf(\"%d %d\", $sum - max($arr), $sum - min($arr));\n}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "public function optimize();", "public function optimize();", "function getMaxSumSubSequence($arr, $li, $ls) {\n\n if($li == $ls) return $arr[ $li ];\n\n $middle = intval(($li+$ls)/2);\n\n\n $bestL = getMaxSumSubSequence($arr, $li, $middle);\n $bestR = getMaxSumSubSequence($arr, $middle+1,$ls);\n\n $maxSuf = -9999; \n $maxPre = -9999;\n\n $suf = 0;\n for($i = $middle;$i >= $li; $i--) {\n\n $suf += $arr[$i]; \n\n if($suf > $maxSuf) {\n $maxSuf = $suf;\n } \n } \n\n $pre = 0;\n for($j = $middle+1;$j <= $ls; $j++) {\n\n $pre += $arr[$j];\n\n if($pre > $maxPre) {\n $maxPre = $pre;\n }\n } \n\n\n return max($bestL, max($bestR, ($maxSuf + $maxPre) )); \n}", "private function _optimize() {}", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "function solution($S, $P, $Q){\r\n $A = $C = $G = $T = 0;\r\n $results = array();\r\n $quantaties = array();\r\n $quantaties[-1]=\"0000\"; \r\n if ((strlen($S) < 1) || (strlen($S) > 100000))\r\n return 0;\r\n if ((count($P) < 1) || (count($P) > 50000))\r\n return 0;\r\n if ((count($Q) < 1) || (count($Q) > 50000))\r\n return 0;\r\n for ($i = 0; $i < strlen($S); $i++) {\r\n switch (substr($S, $i, 1)) {\r\n case 'A':\r\n $A++; \r\n break;\r\n case 'C':\r\n $C++;\r\n break;\r\n case 'G':\r\n $G++;\r\n break;\r\n case 'T':\r\n $T++;\r\n break;\r\n }\r\n $quantaties[$i]=$A.\"|\".$C.\"|\".$G.\"|\".$T; \r\n } \r\n// print_r($quantaties);\r\n $right=$left=array();\r\n for ($i = 0; $i < count($P); $i++) {\r\n $right=explode(\"|\", $quantaties[$Q[$i]]); print_r($right);\r\n $left=explode(\"|\", $quantaties[$P[$i]-1]); print_r($left);\r\n if (($right[0]-$left[0])!=0) $results[$i]=1;\r\n elseif (($right[1]-$left[1])!=0) $results[$i]=2;\r\n elseif (($right[2]-$left[2])!=0) $results[$i]=3;\r\n else $results[$i]=4;\r\n }\r\n return $results;\r\n}", "function leastBricks($wall=[]) { \r\n foreach ($wall as $key => $value) {\r\n for ($i = 0; $i < count($value) - 1; $i++) {\r\n\t\t//the maximum coincidence of the sums of bricks, means the maximum total boundary line\r\n $arr[] = array_sum(array_slice($value, 0, $i + 1));\r\n }\r\n }\r\n\t//the difference of all horizontal lines of bricks and the maximum coincident line will give an our solutuion\r\n return count($wall) - max(array_count_values($arr));\r\n}", "function euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function find_min($nums)\n{\n $smallest = $nums[0];\n for ($i = 1; $i < count($nums); $i++) {\n if ($nums[$i] < $smallest) {\n $smallest = $nums[$i];\n }\n }\n return $smallest;\n}", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}" ]
[ "0.6152062", "0.56653184", "0.5628356", "0.56030554", "0.5586677", "0.55404663", "0.54934293", "0.5446083", "0.5429773", "0.54093146", "0.5397866", "0.53958863", "0.536665", "0.53467995", "0.52943546", "0.52510643", "0.5216274", "0.5210172", "0.5135657", "0.51047444", "0.51047444", "0.50892097", "0.5020945", "0.5005293", "0.49964345", "0.4978493", "0.4977216", "0.49615595", "0.49143422", "0.49109608" ]
0.6439385
0
Tells whether a Relation is a one or many to one relation.
private static function isXToOne(Relation $rel) { return $rel instanceof OneToOne || $rel instanceof ManyToOne ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isRelation()\n {\n return $this instanceof Relation;\n }", "public function canAutoJoin()\n {\n return ($this instanceof SingleRelation);\n }", "public function isRelated();", "public static function isRelation($type)\n {\n return in_array($type, ['ref-one', 'ref-many', 'oneToMany', 'manyToOne', 'manyToMany', 'optionSet']);\n }", "protected function isOneRelation($query)\n {\n $relations = [\n BelongsTo::class, HasOne::class, MorphOne::class, MorphTo::class,\n HasOneThrough::class,\n ];\n\n foreach ($relations as $relation) {\n if ($query instanceof $relation) {\n return true;\n }\n }\n\n return false;\n }", "public function hasRelationOne($fieldName) {\n\t\t$configuration = $this->getConfiguration($fieldName);\n\t\treturn $this->hasRelation($fieldName) && $configuration['maxitems'] == 1;\n\t}", "public function hasRelationship() {\n return $this->_has(1);\n }", "protected function returnSingleAssociation($relation)\n {\n $classes = collect([\n \\Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\HasOne::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\MorphTo::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\MorphOne::class,\n ]);\n\n $relation = $classes->first(function ($class) use ($relation) {\n return is_a($relation, $class);\n });\n\n return $relation ? true : false;\n }", "public function isRel() {\n return substr($this->model, -3) == \"Rel\";\n }", "public function isRelationship($name);", "public function hasRelations()\r\n {\r\n return !empty($this->relations);\r\n }", "public function isRelationshipData();", "public function isHasOne($key)\n {\n if (false === $this->isRelationship($key)) {\n return false;\n }\n return $this->getMetadata()->getRelationship($key)->isOne();\n }", "public function hasOne()\n {\n if ($this->relationship === null)\n {\n $this->relationship = DataModel_Relationship::HAS_ONE;\n return $this;\n }\n else\n {\n \treturn $this->relationship & DataModel_Relationship::HAS_ONE;\n }\n }", "public function hasRelationOneToOne($fieldName) {\n\t\t$result = FALSE;\n\n\t\t$foreignField = $this->getForeignField($fieldName);\n\t\tif (!empty($foreignField)) {\n\n\t\t\t// Load TCA service of foreign field.\n\t\t\t$foreignTable = $this->getForeignTable($fieldName);\n\t\t\t$tcaForeignFieldService = \\TYPO3\\CMS\\Vidi\\Tca\\TcaServiceFactory::getFieldService($foreignTable);\n\t\t\t$result = $this->hasRelationOne($fieldName) && $tcaForeignFieldService->hasRelationOne($foreignField);\n\t\t}\n\t\treturn $result;\n\t}", "private function _has_one($request)\n {\n $relation = $this->_relationships[$request];\n $this->_database->join($relation['foreign_table'], $relation['foreign_table'].'.'.$relation['foreign_key'].' = '.$this->table.'.'.$relation['local_key'], 'left');\n return TRUE;\n }", "protected function isMorphRelation($relation)\n {\n $isMorph = false;\n if ($relation !== null && $relation !== '') {\n $relationParts = explode('.', $relation);\n $firstRelation = array_shift($relationParts);\n $model = $this->query->getModel();\n $isMorph = method_exists($model, $firstRelation) && $model->$firstRelation() instanceof MorphTo;\n }\n\n return $isMorph;\n }", "public function hasOne(Entity|string $entityRelation, string $foreignKey = ''): HasOne|false\n {\n try {\n $entityRelation = $this->getEntity($entityRelation);\n $primaryKey = $entityRelation->getPrimaryKey();\n $preForeignKey = strtolower((new ReflectionClass($entityRelation))->getShortName());\n $foreignKey = $foreignKey ?: $preForeignKey . '_' . $primaryKey;\n $relation = new HasOne($this, $entityRelation, $foreignKey);\n $name = debug_backtrace()[1]['function'] ?? $entityRelation->getManager()->getTable();\n return $this->relations[$name] = $relation;\n } catch (Exception $ex) {\n return false;\n }\n }", "public function isOne()\n {\n return $this->isOne;\n }", "private function determineRelationType() {\n if($this->local_columns[0]->isPrimaryKey() && $this->referenced_columns[0]->isPrimaryKey()) {\n //will either be a one-one relation or a many-many join table\n\n if($this->getLocalTable()->getPrimaryKey() !== null && count(\n $this->getLocalTable()->getPrimaryKey()->getColumns()\n ) > 1\n ) {\n //if local table has more than one PK it's modt likely a join table.\n $type = self::MANY_TO_ONE;\n } elseif($this->getReferencedTable()->getPrimaryKey() !== null && 1 < $num_ref_column = count(\n $this->getReferencedTable()->getPrimaryKey()->getColumns()\n )\n ) {\n //if referencing a table with dual PK, it's most likely a m2m join table that has more to load.\n if($num_ref_column === 2) {\n $type = self::MANY_TO_MANY;\n //go back and find the other relation\n //need to iterate to find the one that's not this.\n foreach($this->getReferencedTable()->getRelations() as $relation) {\n if ($relation->getReferencedColumns() != $this->local_columns) {\n $this->target_relation = $relation;\n break;\n }\n }\n\n //if target relation isn't found, there must be a special case, so just roll back to one-to-many\n //or if target relation has a dual primary key, can't base it being a join table on it anymore.\n if($this->target_relation === null || count(\n $this->target_relation->getReferencedTable()->getPrimaryKey()->getColumns()\n ) > 1\n )\n $type = self::ONE_TO_MANY;\n\n } else {\n //if not 2 PKS it is not reliable enough to assume what's going on.\n $type = self::RELATION_UNKNOWN;\n }\n } else {\n //Otherwise o2o\n $type = self::ONE_TO_ONE;\n }\n\n } elseif($this->is_reverse_relation) {\n $type = self::ONE_TO_MANY;\n } else {\n $type = self::MANY_TO_ONE;\n }\n\n\n return $type;\n }", "public function hasRelations()\n {\n return 0 !== count($this->relations);\n }", "protected function hasCascadeRelationDefined() {\n\n if ( ! is_array($this->relationships) || empty($this->relationships) ) {\n\n return false;\n }\n\n return true;\n }", "protected function isRelationTable($table)\n\t{\n\t\t$pk=$table->primaryKey;\n\t\treturn (count($pk) === 2 // we want 2 columns\n\t\t\t&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key\n\t\t\t&& isset($table->foreignKeys[$pk[1]]) // pk column 2 is also a foriegn key\n\t\t\t&& $table->foreignKeys[$pk[0]][0] !== $table->foreignKeys[$pk[1]][0]); // and the foreign keys point different tables\n\t}", "public function hasRelation($name)\n\t{\n\t\treturn isset($this->relations[$name]);\n\t}", "public function has_or_relation()\n {\n }", "public function hasRelation(string $relation): bool\n {\n return (bool) $this->getRelatedQueryFor($relation);\n }", "public function bidirectional_relation_exists() {\n $this->db->query(\"SELECT * FROM user_relation WHERE (`from` = ? AND `to` = ?) OR (`from` = ? AND `to` = ?)\",\n array(\n $this->from,\n $this->to,\n $this->to,\n $this->from,\n ));\n\n if($this->db->count() > 0) {\n return $this->db->results()[0]->status;\n } else {\n return false;\n }\n }", "public function hasRelation($relation)\n {\n if (!$this->relations) {\n return false;\n }\n\n if (is_array($this->relations) && isset($this->relations[$relation])) {\n return true;\n } elseif (is_object($this->relations) && property_exists($this->relations, $relation)) {\n return true;\n }\n $relations = array_values($this->relations)[0];\n\n return isset($relations->{$relation});\n }", "protected function isOneToOneRelation(Model $parentEntity)\n {\n $relation = $parentEntity->{$this->getRelation()}();\n\n return $relation instanceof HasOne || $relation instanceof MorphOne || $relation instanceof BelongsTo || $relation instanceof HasOneThrough;\n }", "public function getRelationType()\n {\n return $this->relation_type;\n }" ]
[ "0.74016815", "0.68106323", "0.680415", "0.66039115", "0.6597948", "0.65817165", "0.65535295", "0.6481432", "0.63150096", "0.63116264", "0.6306999", "0.61576355", "0.6132554", "0.61204356", "0.6109598", "0.6106486", "0.6071716", "0.60665417", "0.605936", "0.6057006", "0.6056121", "0.60450053", "0.60208744", "0.599395", "0.59739006", "0.59726703", "0.59629494", "0.5876674", "0.57966435", "0.5783346" ]
0.68577045
1
Creates a new Printer instance.
public function __construct(/*private readonly */DefaultPrinter $printer) { $this->printer = $printer; // .. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPrinter();", "public static function USBPrint($printerIp)\n {\n// $printer = new Printer($connector);\n $connector = new NetworkPrintConnector($printerIp, 9100);\n $printer = new Printer($connector);\n return $printer;\n }", "public function __construct(string $printer) {\n parent::__construct();\n $this->printer = $printer;\n }", "protected function create_pdf_object() {\n\n // Default orientation is Landescape.\n $orientation = 'L';\n\n if ($this->get_instance()->height > $this->get_instance()->width) {\n $orientation = 'P';\n }\n\n // Remove commas to avoid a bug in TCPDF where a string containing a commas will result in two strings.\n $keywords = get_string('keywords', 'simplecertificate') . ',' . format_string($this->get_instance()->coursename, true);\n $keywords = str_replace(\",\", \" \", $keywords); // Replace commas with spaces.\n $keywords = str_replace(\" \", \" \", $keywords); // Replace two spaces with one.\n\n $pdf = new pdf($orientation, 'mm', array($this->get_instance()->width, $this->get_instance()->height), true, 'UTF-8');\n $pdf->SetTitle($this->get_instance()->name);\n $pdf->SetSubject($this->get_instance()->name . ' - ' . $this->get_instance()->coursename);\n $pdf->SetKeywords($keywords);\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);\n $pdf->SetAutoPageBreak(false, 0);\n $pdf->setFontSubsetting(true);\n $pdf->SetMargins(0, 0, 0, true);\n\n return $pdf;\n }", "public function setPrinter(Printer $printer = null);", "public function get_print_instance() {\n\n\t\treturn $this->print;\n\t}", "function printer_create_dc($printer_handle)\n{\n}", "public function store(CreatePrinterAPIRequest $request)\n {\n $input = $request->all();\n\n $printer = $this->printerRepository->create($input);\n\n return $this->sendResponse($printer->toArray(), 'Printer saved successfully');\n }", "public function _construct()\n {\n $this->_init('orderprint/orderprint', 'orderprint_id');\n }", "public function actionCreate_printers()\n {\n $model = new Printers();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['/printers/view', 'id' => $model->id_printer]);\n } else {\n return $this->render('/printers/create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate_printers()\n {\n $model = new Printers();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['/printers/view', 'id' => $model->id_printer]);\n } else {\n return $this->render('/printers/create', [\n 'model' => $model,\n ]);\n }\n }", "public static function setPrinter($printer)\n {\n //buscar os dados referente a impressora na base de dados\n //estabelecer qual interface usar (CUPS, REDE, QZ, FILE, etc.)\n //estabelecer qual template usar:\n // Zebra ZPL2,\n // Zebra/Eltron ELP2,\n // Argox PPLA/PPLB,\n // Intermec IPL,\n // DataMax DPL, etc.)\n //carrega classe de acesso a base de dados\n $dbase = new DBase();\n //carrega impressoras\n self::$printer = $dbase->getPrinter($printer);\n \n }", "public static function print(){\r\n \t$printerName = env('PRINTER', 'HP_DeskJet_5820_series');\r\n\r\n \t//sample file\r\n \t$fileName = 'Voucher-4-1.pdf';\r\n \t$filePath = storage_path('app/public/print/' . $fileName);\r\n \t\r\n \t$response = self::runShellCommand('lpr -P ' . $printerName . ' ' . $filePath);\r\n\r\n \treturn $response;\r\n }", "private function generate()\n\t{\n\t\t$printer = require_once __DIR__ . '/Printer.php';\n\t\t$orders = $this->get_waiting_orders();\n\t\t\n\t\t$printer->setup($this);\n\n\t\t/*foreach ($orders as $order) {\n\t\t\t$printer->add($order);\n\t\t}*/\n\n\t\t$printer->output();\n\t}", "public function getPrinter()\n {\n return $this -> printer;\n }", "public function create() {\n $this->createPersonHeader();\n $this->createRecipientHeader();\n $this->createBody();\n $this->createText();\n $this->createFooter();\n }", "public function __construct(DeletePrinterResponder $responder)\n {\n $this->responder = $responder;\n }", "public function getPrinter()\n {\n return $this->printer;\n }", "public static function create(string $data=null): Phpdf {\n if (!$data) {\n $data = pdfStub();\n }\n $file = static::createTempFile();\n fwrite($file, $data);\n return new self($file);\n }", "public function create(array $options = array())\n {\n $pdf = $this->reflClass->newInstanceArgs($this->getConstructorOptions($options));\n\n foreach ($options as $option => $arguments) {\n if (is_callable(array($pdf, 'set' . $option))) {\n if (!is_array($arguments)) {\n if (null === $arguments) {\n $arguments = array();\n } else {\n $arguments = array($arguments);\n }\n }\n\n call_user_func_array(array($pdf, 'set' . $option), $arguments);\n }\n }\n\n return $pdf;\n }", "public function create()\n {\n echo 'create a apple pie'.PHP_EOL;\n }", "public function __construct($ticket, $printer, $driver = null)\n {\n $this->ticket = $ticket;\n $this->printer = $printer;\n $this->driver = $driver;\n }", "function connect($ip_address, $port)\n {\n //$this->connector = new FilePrintConnector(\"/dev/usb/lp0\");\n //$this->connector = new WindowsPrintConnector(\"smb://192.168.0.6/POS-80\");\n //$this->connector = new CupsPrintConnector(\"POS-80\");\n //$this->printer = new Printer($this->connector);\n /* Close printer */\n\n /*$this->connector = new FilePrintConnector(\"php://stdout\");\n $this->printer = new Printer($this->connector);\n */\n\n try {\n //$this->connector = new CupsPrintConnector(\"POS-80C\");\n $this->connector = new WindowsPrintConnector(\"POSS-80\");\n \n /* Print a \"Hello world\" receipt\" */\n $this->printer = new Printer($this->connector);\n //$this->printer -> text(\"TE AMO MCUHO MI VIDA..!\\n\");\n //$this->printer -> cut();\n \n /* Close printer */\n //$this->printer -> close();\n } catch (Exception $e) {\n echo \"Couldn't print to this printer: \" . $e -> getMessage() . \"\\n\";\n }\n }", "private function createApiMock(array $responses = [], $settings = null): PdfPrinter\n {\n $mock = new MockHandler(array_map(function ($item) {\n return $item->get();\n }, $responses));\n $handler = HandlerStack::create($mock);\n\n $pdfPrinter = new PdfPrinter($settings === null ? $this->pdfPrinterSettings : $settings, new Client(['handler' => $handler]));\n\n return $pdfPrinter;\n }", "public static function getTerminal()\n {\n return new Terminal(\n self::getRepository(),\n self::getCart(),\n self::getCartTotal()\n );\n }", "public function __construct()\n {\n parent::__construct('P', 'mm', $this->paperFormat);\n\n $this->incrementY = 6;\n $this->SetMargins(0, 0);\n\n $this->SetFont('Times', '', 14);\n $this->SetAutoPageBreak(false);\n $this->AddPage();\n }", "public function model()\r\n {\r\n return 'App\\Printer';\r\n }", "public function createPrint(\n $username,\n $title,\n $description,\n $fileOriginalName,\n $fileByteSize,\n $fileMimeType\n ): ThreeDPrint;", "public function pc()\n {\n return new Mac();\n }", "public function create() {\n\t \n }" ]
[ "0.62952435", "0.6098094", "0.5961678", "0.5875306", "0.58268577", "0.575805", "0.5686378", "0.5568351", "0.55188984", "0.54504544", "0.54504544", "0.53146243", "0.52919644", "0.5236908", "0.5216187", "0.5202395", "0.51797396", "0.5149941", "0.50577265", "0.49893075", "0.49870047", "0.4966197", "0.49465126", "0.4901149", "0.4883797", "0.4878345", "0.486224", "0.48390007", "0.4830686", "0.48228243" ]
0.62267506
1