function __construct($tablename = 'tasks') { // Register non-persistent attributes // Contruct the object parent::__construct($tablename); // Set specific characteristics $this->idField = 'id'; $this->orderby = 'start_date'; $this->identifierField = 'name'; // Define relationships $this->belongsTo('Project', 'project_id', 'project'); $this->belongsTo('Task', 'parent_id', 'parent'); $this->belongsTo('User', 'owner', 'task_owner'); $this->belongsTo('User', 'altered_by', 'altered'); $this->belongsTo('Taskpriority', 'priority_id', 'priority'); $this->hasMany('Task', 'tasks', 'parent_id'); $this->hasMany('Hour', 'hours'); $this->hasMany('Expense', 'expenses'); $this->hasMany('Resource', 'resources'); $this->hasMany('taskattachment', 'attachments'); $this->hasMany('ProjectEquipmentAllocation', 'equipment_allocations', 'task_id'); //$this->hasMany('ProjectCostCharge', 'purchase_orders', 'task_id'); //$this->hasMany('ProjectCostCharge', 'sales_invoices', 'task_id'); $this->hasMany('POrder', 'porders'); $this->hasMany('PInvoice', 'pinvoices'); $this->actsAsTree(); $this->setParent(); // Define field formats $this->getField('progress')->setFormatter(new PercentageFormatter()); $this->getField('duration')->setFormatter(new IntervalFormatter()); // Define field defaults $this->getField('start_date')->setDefault(mktime(SystemCompanySettings::DAY_START_HOURS, SystemCompanySettings::DAY_START_MINUTES)); // Define validation $this->getField('duration')->blockValidator('NumericValidator'); // Define enumerated types $this->setEnum('progress', getRange(0, 100, 10, true, '', '')); // Define Access Rules // Define link rules for sidebar related view $this->linkRules = array('expenses' => array('modules' => array('link' => array('module' => 'hr'), 'new' => array('module' => 'hr')), 'actions' => array('link', 'new'), 'rules' => array()), 'porders' => array('modules' => array('link' => array('module' => 'purchase_order'), 'new' => array('module' => 'purchase_order')), 'actions' => array('link', 'new'), 'rules' => array(), 'label' => 'Show Purchase Orders'), 'pinvoices' => array('modules' => array('link' => array('module' => 'purchase_invoicing'), 'new' => array('module' => 'purchase_invoicing')), 'actions' => array('link', 'new'), 'rules' => array(), 'label' => 'Show Purchase Invoices')); }
function getPeriod($sPeriod, $iLow, $iHigh) { $aRes = array(); $iStep = 1; $sErr = ''; do { if ('' === $sPeriod) { $sErr = 'Variable sPeriod is emply'; break; } $aParam = explode('/', $sPeriod); if (count($aParam) > 2) { $sErr = 'Error of format for string assigning period'; break; } if (count($aParam) == 2 && is_numeric($aParam[1])) { $iStep = $aParam[1]; } $sPeriod = $aParam[0]; if ($sPeriod != '*') { $aParam = explode('-', $sPeriod); if (count($aParam) > 2) { $sErr = 'Error of format for string assigning period'; break; } if (count($aParam) == 2) { $aRes = getRange($aParam[0], $aParam[1], $iStep); } else { $aRes = explode(',', $sPeriod); } } else { $aRes = getRange($iLow, $iHigh, $iStep); } } while (false); if ($sErr) { // show error or add to log } return $aRes; }
} } $data['first_date'] = getFirstDate($obj['user_id']); $data = array_merge($data, getShop($obj['user_id'], $obj['shop_id'])); $data = array_merge($data, getUnit($obj['unit_id'])); $data = array_merge($data, getCity($obj['city_id'])); $data = array_merge($data, getDistance($obj['user_id'], $obj['shop_id'])); $data = array_merge($data, getBarcode($obj['barcode_value'])); if (!$data['product_name']) { $data['product_name'] = $obj['corrected_name']; if (!$data['product_name']) { unset($data['product_name']); } } $data = array_merge($data, calcWeight($data)); $data = array_merge($data, getRange($obj['date_entered'])); $data = array_merge($data, getNoPurchases($obj['date_entered'])); $data = array_merge($data, getFamilyDetails($obj['user_id'])); $data['discount'] = countDiscount($obj['price'], $obj['discount']); if ($obj['id']) { $data['purchase_id'] = $obj['id']; } addSattelites($data, $obj, saveData('purchase_total', $data)); } print "\n"; if (!$minDate) { print "Executing post generation sql queries:\n"; executeSqlFile('post_generation.sql', TRUE); } print sprintf("Elapsed time: %d minute(s) %4.2f second(s)\n", $min = floor(($time = millisec() - $t0) / 60), $time - 60 * $min); function saveData($table, $data)
function noBorderSpellTable($spell) { echo "<table class=spell><tbody>"; $name = $spell['SpellName']; if ($spell['Rank']) { echo "<tr><td class=Name>" . $name . "</td><td class=Rank align=right>" . $spell['Rank'] . "</td></tr>"; } else { echo "<tr><td class=Name colspan=2>" . $name . "</td></tr>"; } $cost = getSpellCostText($spell); if ($cost or $spell['rangeIndex'] > 1) { echo "<tr><td>"; if ($cost) { echo $cost . "</td><td align=right>"; } if ($spell['rangeIndex'] > 0 and $range = getRange($spell['rangeIndex']) and $range != 0) { echo $range . " yds range"; } echo "</td></tr>"; } // Заполняем поле времени каста $cast_time = ""; if (($spell['Attributes'] & 0x404) == 0x404) { $cast_time = "Next melee"; } else { if ($spell['AttributesEx'] & 0x44) { $cast_time = "Chanelled"; } else { $cast_time = getCastTimeText($spell); } } // Заполняем поле кулдауна $cooldown = getSpellCooldown($spell); if ($cooldown) { $cooldown = getTimeText($cooldown / 1000) . " cooldown"; } else { $cooldown = ""; } if ($cast_time or $cooldown) { echo "<tr><td>" . $cast_time . "</td><td align=right>" . $cooldown . "</td></tr>"; } // Тотем категория if ($spell['TotemCategory_1'] or $spell['TotemCategory_2']) { echo "<tr><td colspan=2 class=tool> Tools: "; if ($spell['TotemCategory_1']) { echo getTotemCategory($spell['TotemCategory_1']); } if ($spell['TotemCategory_2']) { echo ", " . getTotemCategory($spell['TotemCategory_2']); } echo "</td></tr>"; } $itemClass = $spell['EquippedItemClass']; // Требования мили или рангед оружия if ($spell['Attributes'] & 0x2) { echo "<tr><td colspan=2>Requires Ranged Weapon</td></tr>"; } else { if ($spell['Attributes'] & 0x4) { echo "<tr><td colspan=2>Requires Melee Weapon</td></tr>"; } else { if ($itemClass == 2) { echo "<tr><td colSpan=2 class=req>"; if ($itemSubClass = $spell['EquippedItemSubClassMask']) { echo getSubclassList($itemClass, $itemSubClass); } else { echo getClassName($itemClass); } echo "</td></tr>"; } } } $reqForm = getAllowableForm($spell['Stances'], 0); if ($reqForm) { echo "<tr><td colspan=2>Requires: " . $reqForm . "</td></tr>"; } $notreqForm = getAllowableForm($spell['StancesNot'], 0); if ($notreqForm) { echo "<tr><td class=SpellErr colspan=2>Not cast in: " . $notreqForm . "</td></tr>"; } echo "<tr><td colspan=2 class=SpellDesc><a href=\"?spell={$spell['id']}\">" . getSpellDesc($spell) . "</a></td></tr>"; echo "</tbody></table>"; }
public function __invoke() { $this->createLabel(); $alert_text = []; $history = []; $currentTime = new \DateTime(); $today = $currentTime->format('m') + 1 + "/" + $currentTime . getDate() + "/" + $currentTime->format('Y'); $keywordIterator; $line_counter = 0; while ($keywordIterator->hasNext()) { $keyword = keywordIterator . next(); $line_counter++; $current_quality_score = $keyword->qualityScore; $keywordLabelsIterator = keyword . labels() . withCondition("Name STARTS_WITH 'QS: '") . get(); if ($keywordLabelsIterator->hasNext()) { $keyword_label = $keywordLabelsIterator . next(); $matches = new RegExp('QS: ([0-9]+)$') . exec($keyword_label . getName()); $old_quality_score = $matches[1]; } else { $old_quality_score = 0; } // For the history also note the change or whether this keyword is new if ($old_quality_score > 0) { $change = $current_quality_score - $old_quality_score; } else { $change = "NEW"; } $row = [$today, $keyword . getCampaign() . getName(), $keyword . getAdGroup() . getName(), $keyword . getText(), $current_quality_score, $change]; $history . push(row); // If there is a previously tracked quality score and it's different from the current one... if ($old_quality_score > 0 && $current_quality_score != $old_quality_score) { // Make a note of this to log it and possibly send it via email later $alert_text . push($current_quality_score + "\t" + $old_quality_score + "\t" + $change + "\t" + $keyword . getText()); // Remove the old label $keyword . removeLabel($keyword_label . getName()); } // Store the current QS for the next time by using a label $keyword . applyLabel("QS: " + $current_quality_score); } if ($line_counter == 0) { $this->logger->log("Couldn't find any keywords marked for quality score tracking. To mark keywords for tracking, apply the label '" + $label_name + "' to those keywords."); return; } $this->logger->log("Tracked " + $line_counter + " keyword quality scores. To select different keywords for tracking, apply the label '" + $label_name + "' to those keywords."); // Store history $history_sheet = spreadsheet . getSheetByName('QS history'); $history_sheet . getRange($history_sheet . getLastRow() + 1, 1, $history . length, 6) . setValues($history); // If there are notes for alerts then prepare a message to log and possibly send via email if ($alert_text . length) { $message = "The following quality score changes were discovered:\nNew\tOld\tChange\tKeyword\n"; for ($i = 0; $i < count($alert_text); $i++) { $message += $alert_text[i] + "\n"; } // Also include a link to the spreadsheet $message += "\n" + "The complete history is available at " + $spreadsheet . getUrl(); $this->logger->log($message); // If there is an email address send out a notification if ($email_address && $email_address != "YOUR_EMAIL_HERE") { $this->mailer->sendEmail($email_address, "Quality Score Tracker: Changes detected", $message); } } }
<?php # This file contains all the functionality for importing course descriptions from IMS # Server to query $host = 'ldap://directory.srv.ualberta.ca'; $conn = ldap_connect($host); ldap_bind($conn); //binding anonymously // $ranges = getRange($conn); // $years = $ranges['years']; $term = getRange($conn, "Winter"); // only continue if terms were found. No terms means no new file generation if ($term) { // $class_context = "course=096036,term=".$term.",ou=calendar,dc=ualberta,dc=ca"; // $attributes = ['class', 'instructorUid', 'asString', 'classStatus']; // # Some contexts might not exist yet in IMS, which throws an error // $results = @ldap_list($conn,$class_context, "(&(class=*)(classStatus=A))",$attributes); // print("***************"); // if($results) // { // $entries = ldap_get_entries($conn,$results); // print_r($entries); // # remove first "count" element // array_shift($entries); // } //$term=1540 #Winter 2016 $context = "ou=people,dc=ualberta,dc=ca"; // $attributes = ['class', 'instructorUid', 'asString', 'classStatus']; # Some contexts might not exist yet in IMS, which throws an error $results = @ldap_list($conn, $context, "(uid=*)"); if ($results) {
/** * @package:SMS * @MyHelper::getYear(). * @Author:Techno Services */ function getYear() { return getRange(1950, date('Y') - 3); }
function giveResponse() { global $conn; $url; // call function to find what id's are viable // reliant on having no gaps in the database - all id's must be sequential $arr = getRange(); // select the next image to display $sql = "SELECT url FROM pictures WHERE id = " . rand($arr[1], $arr[0]); if ($result = $conn->query($sql)) { while ($row = $result->fetch_object()) { $url = $row->url; } } // return a string of the URL return $url; }