예제 #1
0
파일: DAO.php 프로젝트: ribrain80/suncharts
 /**
  * Get work load by customer
  * @param int $code analysis ID
  * @return array the recordset
  */
 public function getLabWorkloadByoID($y, $oTypeID, $oID, $countryID)
 {
     // # Response container init
     $Response = new ServiceResponse();
     // # Check Handle
     if (!$this->linkD) {
         return $Response;
     }
     // # Response container init
     $data = array();
     try {
         // # Execute query
         $RS = $this->linkD->Execute("\r\n\r\n                    SET NOCOUNT ON;\r\n\r\n                    DECLARE @TAB TABLE([Month] nvarchar(3), [WorkedHours] float)\r\n                    INSERT INTO @TAB SELECT 'Jan' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 1,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Feb' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 2,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Mar' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 3,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Apr' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 4,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'May' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 5,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Jun' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 6,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Jul' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 7,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Aug' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 8,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Sep' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 9,  '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Oct' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 10, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Nov' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 11, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n                    INSERT INTO @TAB SELECT 'Dec' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 12, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n \r\n                    SELECT * FROM @TAB;\r\n\r\n            ");
         // # Check if something went wrong
         if (!$RS) {
             throw new \Exception("Unable to retrieve data for getLabWorkloadByCustomer!");
         }
         // # retrieveing data and building response
         while (!$RS->EOF) {
             $data[] = $RS->fields;
             $RS->MoveNext();
         }
         // # Check if something went wrong
         if (sizeOf($data) == 0) {
             throw new \Exception("No data to retrieve for getLabWorkloadByCustomer!");
         }
         // # Return response
         $Response->status = ServiceResponse::STATUS_OK;
         $Response->data = $data;
     } catch (\Exception $e) {
         $this->logger->addError($e->getMessage());
     }
     return $Response;
 }
예제 #2
0
 public function check_ipn_response()
 {
     if (sizeOf($_POST) == 0) {
         header("HTTP/1.1 500 EMPTY_POST ");
         return false;
     }
     if (!isset($_POST['transaction_id']) || !isset($_POST['reference_id'])) {
         header("HTTP/1.1 500 BAD_PARAMETERS");
         return false;
     }
     $transaction_id = filter_var($_POST['transaction_id'], FILTER_SANITIZE_STRING);
     $url = 'https://www.bitpagos.net/api/v1/transaction/' . $transaction_id . '/?api_key=' . $this->get_option('api_key') . '&format=json';
     $cbp = curl_init($url);
     curl_setopt($cbp, CURLOPT_RETURNTRANSFER, TRUE);
     $response_curl = curl_exec($cbp);
     curl_close($cbp);
     $response = json_decode($response_curl);
     $order_id = (int) $_POST['reference_id'];
     if ($order_id != $response->reference_id) {
         die('Wrong reference id');
     }
     if ($response->status == 'PA' || $response->status == 'CO') {
         global $woocommerce;
         $order = new WC_Order($order_id);
         $order->update_status('completed');
         $order->payment_complete();
         file_put_contents('/tmp/ipn.log', print_r($order, TRUE));
         header("HTTP/1.1 200 OK");
     }
 }
예제 #3
0
 public function insertVenue($result)
 {
     for ($i = 0; i < sizeOf($result); $i++) {
         $this->insertVenueData->bind_param("ssddsdsssss", $result[$i]['id'], $result[$i]['name'], $result[$i]['lat'], $result[$i]['lng'], $result[$i]['address'], $result[$i]['rating'], $result[$i]['zipcode'], $result[$i]['city'], $result[$i]['state'], $result[$i]['phone'], Foursquare, $result[$i]['url']);
         $this->insertVenueData->execute();
     }
 }
예제 #4
0
function ltheme_tab_shortcode($atts, $content = null)
{
    global $ltheme_tab_array;
    $ltheme_tab_array = array();
    do_shortcode($content);
    $num = sizeOf($ltheme_tab_array);
    $tab = '<div class="ltheme-tab">';
    // tab title
    $tab = $tab . '<ul class="ltheme-tab-title">';
    for ($i = 0; $i < $num; $i++) {
        $active = $i == 0 ? 'class="active" ' : '';
        $tab = $tab . '<li><a data-tab="tab-' . $i . '" ' . $active;
        $tab = $tab . '>' . $ltheme_tab_array[$i]["title"] . '</a></li>';
    }
    $tab = $tab . '</ul>';
    // tab content
    $tab = $tab . '<div class="clear"></div>';
    $tab = $tab . '<ul class="ltheme-tab-content">';
    for ($i = 0; $i < $num; $i++) {
        $active = $i == 0 ? 'class="active" ' : '';
        $tab = $tab . '<li data-tab="tab-' . $i . '" ' . $active;
        $tab = $tab . '>' . $ltheme_tab_array[$i]["content"] . '</li>';
    }
    $tab = $tab . "</ul>";
    // ltheme-tab-content
    $tab = $tab . "</div>";
    // ltheme-tab
    return $tab;
}
예제 #5
0
/**
 * Breadcrumbs for the Perfectum Theme
 *
 * @version 1.0
 * @since   1.0
 * @author  Daniel Noel-Davies
 *
 * @param   array  $block       Array of block values
 *
 */
function block_pagination($block)
{
    // Get instances...
    $objPage = coreObj::getPage();
    $objTPL = coreObj::getTPL();
    $breadcrumbs = $objPage->getOptions('breadcrumbs');
    $length = sizeOf($breadcrumbs);
    // Check we have breadcrumbs to work with
    if (!empty($breadcrumbs)) {
        return false;
    }
    // Give this block a handle
    $objTPl->set_filenames(array('perfectum_breadcrumbs', Page::$THEME_ROOT . 'breadcrumbs.tpl'));
    // Loop through breadcrumbs and assign the array values to each template block
    foreach ($breadcrumbs as $index => $crumb) {
        if ($index < $length) {
            $objTPL->assign_block_vars('crumb', array('URL' => $crumb['url'], 'TITLE' => $crumb['name']));
            // If this is the last crumb, make it un-clickable
        } else {
            $objTPL->assign_block_vars('crumb', array('TITLE' => $crumb['name']));
        }
    }
    // Return the block's contents
    return $objTPL->get_html('perfectum_breadcrumbs');
}
예제 #6
0
function get_pronoun_id($subjP, $objP, $possDetP, $possP, $reflexP)
{
    $pronoun_hash = hashPronouns($subjP, $objP, $possDetP, $possP, $reflexP);
    $db = connectDB();
    try {
        $stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
        $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        if (sizeOf($rows) != 0) {
            $pronounID = $rows[0]['pronoun_id'];
        } else {
            $stmt = $db->prepare("INSERT INTO cr_pronouns(pronoun_id, pronoun_hash, subj, obj, poss_det, poss_pro,\n                                  reflexive) VALUES('', :pronoun_hash, :subj, :obj, :poss_det, :poss_pro,\n                                  :reflexive);");
            $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
            $stmt->bindValue(':subj', $subjP, PDO::PARAM_STR);
            $stmt->bindValue(':obj', $objP, PDO::PARAM_STR);
            $stmt->bindValue(':poss_det', $possDetP, PDO::PARAM_STR);
            $stmt->bindValue(':poss_pro', $possP, PDO::PARAM_STR);
            $stmt->bindValue(':reflexive', $reflexP, PDO::PARAM_STR);
            $stmt->execute();
            $stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
            $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
            $stmt->execute();
            $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $pronounID = $rows[0]['pronoun_id'];
        }
    } catch (PDOException $ex) {
        header("Location: ./register?err=pronoun");
    }
    return $pronounID;
}
 public function update($data)
 {
     $PerchEvents_Events = new PerchEvents_Events();
     if (isset($data['eventDescRaw'])) {
         $data['eventDescHTML'] = $PerchEvents_Events->text_to_html($data['eventDescRaw']);
     } else {
         $data['eventDescHTML'] = false;
     }
     if (isset($data['eventTitle'])) {
         $data['eventSlug'] = PerchUtil::urlify(date('Y m d', strtotime($data['eventDateTime'])) . ' ' . $data['eventTitle']);
     }
     if (isset($data['cat_ids'])) {
         $catIDs = $data['cat_ids'];
         unset($data['cat_ids']);
     } else {
         $catIDs = false;
     }
     // Update the event itself
     parent::update($data);
     // Delete existing categories
     $this->db->delete(PERCH_DB_PREFIX . 'events_to_categories', $this->pk, $this->id());
     // Add new categories
     if (is_array($catIDs)) {
         for ($i = 0; $i < sizeOf($catIDs); $i++) {
             $tmp = array();
             $tmp['eventID'] = $this->id();
             $tmp['categoryID'] = $catIDs[$i];
             $this->db->insert(PERCH_DB_PREFIX . 'events_to_categories', $tmp);
         }
     }
     return true;
 }
예제 #8
0
파일: QuerizerTest.php 프로젝트: bf13/bf13
 public function testRetrieveAll()
 {
     $items = $this->querizer->from('My\\Dom\\Identity')->datafields(array('name'))->conditions(array('active' => null))->sort(array('name' => 'DESC'))->group(array('name'))->results();
     $this->assertEquals(2, sizeOf($items));
     $this->assertEquals('Bob', $items[1]['name']);
     $this->assertEquals('Jack', $items[3]['name']);
 }
예제 #9
0
 function getMimeTypeForFile($file, $default = 'application/octet-stream')
 {
     $ext = "";
     $arr = explode(".", $file);
     $ext = $arr[sizeOf($arr) - 1];
     return getMimeTypeFor($ext);
 }
예제 #10
0
 public function getArray($enPremie)
 {
     $premieArray = split('[|]', trim($enPremie));
     if (sizeOf($premieArray) == 30) {
         return array("doId" => $premieArray[0], "utstillingId" => $premieArray[1], "hundId" => $premieArray[2], "katalogNr" => $premieArray[3], "personIdDommer" => $premieArray[4], "klasse" => $premieArray[5], "kjonn" => $premieArray[6], "raseId" => $premieArray[7], "IM" => $premieArray[8], "KIP" => $premieArray[9], "JK" => $premieArray[10], "JKK" => $premieArray[11], "UK" => $premieArray[12], "UKK" => $premieArray[13], "BK" => $premieArray[14], "BKK" => $premieArray[15], "AK" => $premieArray[16], "AKK" => $premieArray[17], "VK" => $premieArray[18], "CHK" => $premieArray[19], "CHKK" => $premieArray[20], "VTK" => $premieArray[21], "VTKK" => $premieArray[22], "HP" => $premieArray[23], "CK" => $premieArray[24], "CC" => $premieArray[25], "CA" => $premieArray[26], "BIK" => $premieArray[27], "BIR" => $premieArray[28], "BIM" => $premieArray[29]);
     }
 }
예제 #11
0
파일: form.php 프로젝트: srueegger/1zu12bB
 /**
  *
  * @return array 
  */
 public function getFields()
 {
     if (sizeOf($this->fields) == 0) {
         $this->loadFields();
     }
     return $this->fields;
 }
예제 #12
0
파일: Brackets.php 프로젝트: dukle/codility
function solution($A)
{
    $sizeOfString = strlen($A);
    $i = 0;
    $j = 0;
    $B = array();
    while ($i < $sizeOfString) {
        if (!isset($B[$j])) {
            $B[$j] = $A[$i];
            $i++;
        } else {
            //            var_dump("***");
            //            var_dump("$i: $A[$i] - " .complement($A[$i]));
            if (complement($A[$i]) == $B[$j]) {
                array_pop($B);
                if ($j > 0) {
                    $j--;
                }
            } else {
                array_push($B, $A[$i]);
                $j++;
            }
            $i++;
        }
    }
    if (sizeOf($B) > 0 || $sizeOfString == 0) {
        return 0;
    } else {
        return 1;
    }
}
예제 #13
0
파일: Auth.php 프로젝트: RTougjas/TP2015
 function login()
 {
     $this->data['title'] = "Login";
     //validate form input
     $this->form_validation->set_rules('identity', 'Identity', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     if ($this->form_validation->run() == true) {
         // check to see if the user is logging in
         // check for "remember me"
         $remember = (bool) $this->input->post('remember');
         if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember)) {
             //if the login is successful
             //redirect them back to the home page
             if (sizeOf($this->session->flashdata('uploadAttempt')) > 0) {
                 redirect("/" . $this->session->flashdata('uploadAttempt'));
             } else {
                 $this->session->set_flashdata('message', $this->ion_auth->messages());
                 redirect('/', 'refresh');
             }
         } else {
             // if the login was un-successful
             // redirect them back to the login page
             $this->session->set_flashdata('message', $this->ion_auth->errors());
             redirect('auth/login', 'refresh');
             // use redirects instead of loading views for compatibility with MY_Controller libraries
         }
     } else {
         // the user is not logging in so display the login page
         // set the flash data error message if there is one
         $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
         $this->data['identity'] = array('name' => 'identity', 'id' => 'identity', 'type' => 'text', 'value' => $this->form_validation->set_value('identity'));
         $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password');
         $this->_render_page('auth/login', $this->data);
     }
 }
예제 #14
0
 /**
  * Converts from an array of user.branch.firstName=>abc, to standard objects
  * {
  *    user:{
  *        branch:{
  *            firstName:abc
  *        }
  *    }
  * }
  *
  * @param string[] $input
  *
  * @return \stdClass
  * @throws Exception
  */
 public function convert(array $input)
 {
     //Convert to objects
     $returnVar = new \stdClass();
     foreach ($input as $name => $value) {
         $parts = explode($this->getDelimiter(), $name);
         $currentPart = $returnVar;
         $count = sizeOf($parts);
         foreach ($parts as $key => $part) {
             //Ignore all that have a blank part
             if ($part == '') {
                 break;
             }
             if ($key + 1 == $count) {
                 $currentPart->{$part} = $value;
             } else {
                 $part = ucfirst($part);
                 if (!isset($currentPart->{$part})) {
                     $item = new \stdClass();
                     $currentPart->{$part} = $item;
                 } else {
                     //Account for the url of ?employeeType&employeeType.name=1099 with employeeType and employeeType.name
                     if (!is_object($currentPart->{$part})) {
                         throw new Exception('You cannot pass in both ' . $part . ', and ' . implode('.', $parts), 400);
                     }
                 }
                 $currentPart = $currentPart->{$part};
             }
         }
     }
     return $returnVar;
 }
예제 #15
0
function __autoload($class_name)
{
    $imported = false;
    $namespaces = explode("_", strtolower($class_name));
    if (sizeOf($namespaces) == 3) {
        if ($namespaces[0] == "plugin") {
            if (file_exists("system/plugins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php")) {
                require_once "system/plugins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php";
                $imported = true;
            }
        } else {
            if ($namespaces[0] == "skin") {
                if (file_exists("system/skins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php")) {
                    require_once "system/skins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php";
                    $imported = true;
                }
            }
        }
    }
    if (!$imported) {
        if (file_exists("system/classes/" . strtolower($class_name) . ".php")) {
            require_once "system/classes/" . strtolower($class_name) . ".php";
        }
    }
    $GLOBALS['loadedClasses']++;
}
예제 #16
0
파일: LoadData.php 프로젝트: bf13/bf13
 protected function generateEntities($filename, $file)
 {
     $data = Yaml::parse($file);
     if (!is_array($data)) {
         return;
     }
     foreach ($data as $entity_name => $inputs) {
         $associationNames = $this->manager->getClassMetadata($entity_name)->getAssociationNames();
         if (!sizeOf($inputs)) {
             continue;
         }
         foreach ($inputs as $key => $properties) {
             $entity = new $entity_name();
             foreach ($properties as $property => $value) {
                 $setter = sprintf('set%s', $this->camelize($property));
                 if (in_array($property, $associationNames)) {
                     $value = $this->key[$value];
                 }
                 $entity->{$setter}($value);
             }
             $this->manager->persist($entity);
             $this->key[$key] = $entity;
         }
     }
     $this->manager->flush();
 }
예제 #17
0
 private function _testAPINewerTimestamp($objectType)
 {
     $objectTypePlural = API::getPluralObjectType($objectType);
     $xml = Sync::updated(self::$sessionID);
     $lastSyncTimestamp = $xml['timestamp'];
     // Create via sync
     switch ($objectType) {
         case 'collection':
             $keys[] = Sync::createCollection(self::$sessionID, self::$config['libraryID'], "Test", false, $this);
             break;
         case 'item':
             $keys[] = Sync::createItem(self::$sessionID, self::$config['libraryID'], "book", false, $this);
             break;
         case 'search':
             $keys[] = Sync::createSearch(self::$sessionID, self::$config['libraryID'], "Test", 'default', $this);
             break;
     }
     $response = API::userGet(self::$config['userID'], "{$objectTypePlural}?key=" . self::$config['apiKey'] . "&newertime={$lastSyncTimestamp}&format=keys");
     $this->assertEquals(200, $response->getStatus());
     $responseKeys = explode("\n", trim($response->getBody()));
     $this->assertCount(sizeOf($keys), $responseKeys);
     foreach ($keys as $key) {
         $this->assertContains($key, $responseKeys);
     }
     // Should be empty with later timestamp
     $xml = Sync::updated(self::$sessionID);
     $lastSyncTimestamp = $xml['timestamp'];
     $response = API::userGet(self::$config['userID'], "{$objectTypePlural}?key=" . self::$config['apiKey'] . "&newertime=" . ($lastSyncTimestamp + 2) . "&format=keys");
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals("", trim($response->getBody()));
 }
예제 #18
0
 public function createTeamMembership($teamId = '', $options = array())
 {
     if (sizeOf($options) < 1 || $teamId == '') {
         return ApiException::errorMessage(999);
     }
     $requestParams = array();
     $requestParams["teamId"] = $teamId;
     if (isset($options["personId"])) {
         $requestParams["personId"] = $options["personId"];
     }
     if (isset($options["personEmail"])) {
         $requestParams["personEmail"] = $options["personEmail"];
     }
     if (isset($options["isModerator"])) {
         $requestParams["isModerator"] = $options["isModerator"];
     }
     $mJson = json_encode($requestParams);
     $client = new Client();
     try {
         $response = $client->post(self::TEAMMEMBERSHIPURI, array('headers' => $this->getBaseHeaders(), 'body' => $mJson, 'verify' => false));
     } catch (ClientException $e) {
         $errorResponse = $e->getResponse();
         $statusCode = $errorResponse->getStatusCode();
         if ($statusCode == 401) {
             $response = $client->post(self::TEAMMEMBERSHIPURI, array('headers' => $this->getRefreshHeaders(), 'body' => $mJson, 'verify' => false));
         } else {
             if ($statusCode != 200) {
                 return ApiException::errorMessage($statusCode);
             }
         }
     }
     return $response;
 }
 public function updateMultiple()
 {
     $inputs = Input::all();
     $collection = new Collection();
     for ($i = 0; $i < sizeOf($inputs); $i++) {
         // get input item
         //
         $input = $inputs[$i];
         if (array_key_exists('restricted_domain_id', $input)) {
             // find existing model
             //
             $restrictedDomainId = $input['restricted_domain_id'];
             $restrictedDomain = RestrictedDomain::where('restricted_domain_id', '=', $restrictedDomainId)->first();
             $collection->push($restrictedDomain);
         } else {
             // create new model
             //
             $restrictedDomain = new RestrictedDomain();
         }
         // update model
         //
         $restrictedDomain->domain_name = $input['domain_name'];
         $restrictedDomain->description = $input['description'];
         // save model
         //
         $restrictedDomain->save();
     }
     return $collection;
 }
 public static function processData($caller, $key, $data, &$processedData)
 {
     if (is_array($data) && sizeOf($data) > 0) {
         $include = new CrelishJsonDataProvider('asset', [], $data['uuid']);
         $processedData[$key] = $include->one();
     }
 }
예제 #21
0
파일: Tsv.php 프로젝트: tomnomnom/phargs
 public function addRow(array $row)
 {
     if (sizeOf($row) != $this->fieldCount) {
         return false;
     }
     $this->rows[] = $row;
 }
function letters_search_str($offset_page, $prev_page, $next_page, $pages_count)
{
    /* Setup query for 1st char of fullname, company, lastname using user lang */
    $chars = lang('alphabet');
    if ($chars == 'alphabet*') {
        $chars = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z';
    }
    $aar = explode(',', $chars);
    unset($chars);
    $aar[] = lang("elg_all");
    $search_str = '<input type="hidden" name="wordChar" id="wordChar" value="' . $_POST["wordChar"] . '">';
    $search_str .= "<table align=\"center\"><tr class=divSideboxEntry  colspan=" . (sizeOf($aar) + 4) . ">";
    foreach ($aar as $char) {
        $search_str .= "<td class='letter_box'>";
        if ($char == lang("elg_all")) {
            $isThat = $_POST["wordChar"] === "" || !isset($_POST["wordChar"]);
            $search_str .= "<a href=\"javascript:doABCQuery('');\">";
            $search_str .= sprintf("%s%s%s", $isThat ? "<span class='selectedLetter'>" : "", $char, $isThat ? "</span>" : "");
            $search_str .= "</a>";
        } else {
            $isThat = $_POST["wordChar"] === $char;
            $search_str .= "<a href=\"javascript:doABCQuery('" . $char . "');\">";
            $search_str .= sprintf("%s%s%s", $isThat ? "<span class='selectedLetter'>" : "", $char, $isThat ? "</span>" : "");
            $search_str .= "</a>";
        }
        $search_str .= "</td>";
    }
    unset($aar);
    unset($char);
    $search_str .= "</tr></table>";
    return $search_str;
}
예제 #23
0
 /**
  * 
  * returns the datafields
  * @return list of datafields
  */
 public function getFields()
 {
     if (sizeOf($this->fields) == 0) {
         $this->fields = DataField::getByDataType($this);
     }
     return $this->fields;
 }
예제 #24
0
 public function valid()
 {
     if ($this->counter >= sizeOf($this->data)) {
         return false;
     }
     return true;
 }
예제 #25
0
 /**
  * Constructor
  * @param Configuration $configuration
  * @param string $localTable
  * @param string $localColumn
  * @param string $remoteTable
  * @param string $remoteColumn
  * @param string $type
  * @param string $rawChanges
  */
 public function __construct(Configuration $configuration, $localTable, $localColumn, $remoteTable, $remoteColumn, $type, $rawChanges)
 {
     $this->setLocalTable($localTable);
     $this->setLocalColumn($localColumn);
     $this->setRemoteTable($remoteTable);
     $this->setRemoteColumn($remoteColumn);
     $this->setRemoteModel($configuration->getRootNamespace() . '\\Models\\' . $configuration->getModelSubNamespace() . '\\' . ucfirst($this->getRemoteTable()));
     $this->setRelationshipType($type);
     $this->setAction('NO_ACTION');
     if (preg_match_all('@ON (?P<actionType>(DELETE|UPDATE)+) (?P<action>(SET NULL|NO ACTION|CASCADE))@', $rawChanges, $subMatches)) {
         $length = sizeOf($subMatches[0]);
         $changes = array();
         for ($i = 0; $i < $length; $i++) {
             $changes[$subMatches['actionType'][$i]] = $subMatches['action'][$i];
         }
         $action = 'NO_ACTION';
         if (isset($changes['DELETE']) && $changes['DELETE'] == 'SET NULL') {
             $this->setNullable(true);
             $action = 'NO_ACTION';
         } elseif (isset($changes['DELETE']) && $changes['DELETE'] == 'CASCADE') {
             $action = 'ACTION_CASCADE';
         }
         $this->setAction($action);
     }
 }
예제 #26
0
파일: Model.php 프로젝트: phcs93/proline
 public function getHtmlData()
 {
     $htmlDataString = "";
     foreach (get_class_methods(get_called_class()) as $method) {
         if (substr($method, 0, 3) == "get" && $method != "getHtmlData" && $method != "getPK") {
             $ref = new ReflectionMethod($this, $method);
             if (sizeOf($ref->getParameters()) == 0) {
                 $field = strtolower(substr($method, 3));
                 $value = $this->{$method}();
                 if (is_object($value)) {
                     if (get_class($value) != "Doctrine\\ORM\\PersistentCollection") {
                         $field = "id{$field}";
                         $pkGetter = "get" . $field;
                         $value = $value->{$pkGetter}();
                         $data = "data-{$field}=\"" . $value . "\" ";
                         $htmlDataString .= $data;
                     }
                 } else {
                     $data = "data-{$field}=\"" . $value . "\" ";
                     $htmlDataString .= $data;
                 }
             }
         }
     }
     return $htmlDataString . " data-crud=" . get_called_class() . " data-string=" . $this;
 }
예제 #27
0
 public function getArray($enVeteriner)
 {
     $veterinerArray = split('[|]', $enVeteriner);
     if (sizeOf($veterinerArray) == 12) {
         return array("veterinerId" => $veterinerArray[0], "personId" => $veterinerArray[1], "adresse1" => $veterinerArray[2], "adresse2" => $veterinerArray[3], "adresse3" => $veterinerArray[4], "postNr" => $veterinerArray[5], "telefon" => $veterinerArray[6], "telefax" => $veterinerArray[7], "klinikkNavn" => $veterinerArray[8], "regDato" => Verktoy::konverterDatTilDatabaseDato($veterinerArray[9]), "regAv" => $veterinerArray[10], "endretAv" => $veterinerArray[11]);
     }
 }
 public function configure()
 {
     $employeeId = $this->getOption('employeeId');
     $date = $this->getOption('date');
     $records = $this->getAttendanceService()->getAttendanceRecord($employeeId, $date);
     $totalRows = sizeOf($records);
     $inputDatePattern = sfContext::getInstance()->getUser()->getDateFormat();
     if ($records != null) {
         for ($i = 1; $i <= $totalRows; $i++) {
             $this->setWidget('recordId_' . $i, new sfWidgetFormInputHidden());
             $this->setWidget('InOffset_' . $i, new sfWidgetFormInputHidden());
             $this->setWidget('OutOffset_' . $i, new sfWidgetFormInputHidden());
             $this->setWidget('punchInDate_' . $i, new ohrmWidgetDatePicker());
             $this->setWidget('punchInTime_' . $i, new sfWidgetFormInputText());
             $this->setWidget('inNote_' . $i, new sfWidgetFormInputText(array(), array('class' => 'inNote')));
             $this->setWidget('punchOutDate_' . $i, new ohrmWidgetDatePicker());
             $this->setWidget('punchOutTime_' . $i, new sfWidgetFormInputText());
             $this->setWidget('outNote_' . $i, new sfWidgetFormInputText(array(), array('class' => 'outNote')));
         }
         $this->widgetSchema->setNameFormat('attendance[%s]');
         for ($i = 1; $i <= $totalRows; $i++) {
             $this->setValidator('recordId_' . $i, new sfValidatorString());
             $this->setValidator('InOffset_' . $i, new sfValidatorString());
             $this->setValidator('OutOffset_' . $i, new sfValidatorString());
             $this->setValidator('punchInDate_' . $i, new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => true), array('invalid' => 'Date format should be ' . $inputDatePattern)));
             $this->setValidator('punchInTime_' . $i, new sfValidatorDateTime(array('required' => __('Enter Punch In Time'))));
             $this->setValidator('inNote_' . $i, new sfValidatorString(array('required' => false, 'max_length' => 255)));
             $this->setValidator('punchOutDate_' . $i, new ohrmDateValidator(array('date_format' => $inputDatePattern, 'required' => false), array('invalid' => 'Date format should be ' . $inputDatePattern)));
             $this->setValidator('punchOutTime_' . $i, new sfValidatorDateTime(array('required' => false)));
             $this->setValidator('outNote_' . $i, new sfValidatorString(array('required' => false, 'max_length' => 255)));
         }
         $i = 1;
         foreach ($records as $record) {
             if ($record->getPunchOutUserTime() == null) {
                 $this->setDefault('recordId_' . $i, $record->getId());
                 $this->setDefault('InOffset_' . $i, $record->getPunchInTimeOffset());
                 $this->setDefault('punchInDate_' . $i, date($inputDatePattern, strtotime($record->getPunchInUserTime())));
                 $this->setDefault('punchInTime_' . $i, date('H:i', strtotime($record->getPunchInUserTime())));
                 $this->setDefault('inNote_' . $i, $record->getPunchInNote());
                 $this->setDefault('outNote_' . $i, "");
                 $this->setDefault('OutOffset_' . $i, 0);
             } else {
                 $this->setDefault('recordId_' . $i, $record->getId());
                 $this->setDefault('InOffset_' . $i, $record->getPunchInTimeOffset());
                 $this->setDefault('OutOffset_' . $i, $record->getPunchOutTimeOffset());
                 $this->setDefault('punchInDate_' . $i, date($inputDatePattern, strtotime($record->getPunchInUserTime())));
                 $this->setDefault('punchInTime_' . $i, date('H:i', strtotime($record->getPunchInUserTime())));
                 $this->setDefault('inNote_' . $i, $record->getPunchInNote());
                 $this->setDefault('punchOutDate_' . $i, date($inputDatePattern, strtotime($record->getPunchOutUserTime())));
                 $this->setDefault('punchOutTime_' . $i, date('H:i', strtotime($record->getPunchOutUserTime())));
                 $this->setDefault('outNote_' . $i, $record->getPunchOutNote());
                 if (date('Y-m-d', strtotime($record->getPunchOutUserTime())) != $date) {
                     $this->nonEditableOutDate[] = $i;
                 }
             }
             $i++;
         }
     }
 }
예제 #29
0
 public function testTransactions()
 {
     $disbursement = Braintree\Disbursement::factory(array("id" => "123456", "merchantAccount" => array("id" => "sandbox_sub_merchant_account", "masterMerchantAccount" => array("id" => "sandbox_master_merchant_account", "status" => "active"), "status" => "active"), "transactionIds" => array("sub_merchant_transaction"), "exceptionMessage" => "invalid_account_number", "amount" => "100.00", "disbursementDate" => new DateTime("2013-04-10"), "followUpAction" => "update", "retry" => false, "success" => false));
     $transactions = $disbursement->transactions();
     $this->assertNotNull($transactions);
     $this->assertEquals(sizeOf($transactions), 1);
     $this->assertEquals($transactions->firstItem()->id, 'sub_merchant_transaction');
 }
예제 #30
0
 public function display()
 {
     if (sizeOf($_FILES) == 0) {
         $this->showUploadForm();
     } else {
         $this->upload();
     }
 }