Exemplo n.º 1
0
function smarty_function_treetable($params, $smarty)
{
    global $headerlib, $tree_table_id, $prefs;
    extract($params);
    $_emptyDataMessage = empty($_emptyDataMessage) ? tra('No rows found') : $_emptyDataMessage;
    if (empty($_data)) {
        return $_emptyDataMessage;
    }
    $_checkbox = empty($_checkbox) ? '' : $_checkbox;
    $_checkboxTitles = empty($_checkboxTitles) ? '' : $_checkboxTitles;
    $_openall = isset($_openall) ? $_openall : 'n';
    $_showSelected = isset($_showSelected) ? $_showSelected : 'n';
    $_selectAllHiddenToo = isset($_selectAllHiddenToo) ? $_selectAllHiddenToo : 'n';
    if (is_string($_checkbox) && strpos($_checkbox, ',') !== false) {
        $_checkbox = preg_split('/,/', trim($_checkbox));
    }
    if (!empty($_checkboxColumnIndex)) {
        if (is_string($_checkboxColumnIndex) && strpos($_checkboxColumnIndex, ',') !== false) {
            $_checkboxColumnIndex = preg_split('/,/', trim($_checkboxColumnIndex));
        }
        if (count($_checkbox) != count($_checkboxColumnIndex)) {
            return 'Number of items in _checkboxColumnIndex doesn not match items in _checkbox';
        }
    }
    if (!empty($_checkboxTitles)) {
        if (is_string($_checkboxTitles)) {
            if (strpos($_checkboxTitles, ',') !== false) {
                $_checkboxTitles = preg_split('/,/', trim($_checkboxTitles));
            } else {
                $_checkboxTitles = array(trim($_checkboxTitles));
            }
        }
        if (count($_checkbox) != count($_checkboxTitles)) {
            return 'Number of items in _checkboxTitles doesn not match items in _checkbox';
        }
    }
    $_checkboxColumnIndex = empty($_checkboxColumnIndex) ? 0 : $_checkboxColumnIndex;
    $_valueColumnIndex = empty($_valueColumnIndex) ? 0 : $_valueColumnIndex;
    if (!empty($_checkbox) && !is_array($_checkbox)) {
        $_checkbox = array($_checkbox);
        $_checkboxColumnIndex = array($_checkboxColumnIndex);
    }
    $_columnsContainHtml = isset($_columnsContainHtml) ? $_columnsContainHtml : 'n';
    $html = '';
    $nl = "\n";
    // some defaults
    $_listFilter = empty($_listFilter) ? 'y' : $_listFilter;
    $_filterMinRows = empty($_filterMinRows) ? 12 : $_filterMinRows;
    $_collapseMaxSections = empty($_collapseMaxSections) ? 4 : $_collapseMaxSections;
    $_rowClasses = !isset($_rowClasses) ? array('odd', 'even') : (is_array($_rowClasses) ? $_rowClasses : array($_rowClasses));
    if (!empty($_rowClasses)) {
        $oddEvenCounter = 0;
    } else {
        $oddEvenCounter = -1;
    }
    // auto-increment val for unique id's etc
    if (empty($id)) {
        if (!isset($tree_table_id)) {
            $tree_table_id = 1;
        } else {
            $tree_table_id++;
        }
        $id = 'treetable_' . $tree_table_id;
    }
    // TODO - check this? add key/val pairs?
    if (empty($_columns)) {
        $keys = array_keys($_data[0]);
        $_columns = array();
        foreach ($keys as $key) {
            if (!is_numeric($key)) {
                $_columns[$key] = htmlspecialchars($key);
            }
        }
    } else {
        if (is_string($_columns)) {
            $ar = preg_split('/,/', $_columns);
            $_columns = array();
            foreach ($ar as $str) {
                $ar2 = preg_split('/=/', trim($str));
                $_columns[trim($ar2[0], ' "')] = trim($ar2[1], ' "');
            }
            unset($ar, $ar2);
        }
    }
    $_sortColumn = empty($_sortColumn) ? '' : $_sortColumn;
    $_groupColumn = empty($_groupColumn) ? '' : $_groupColumn;
    if ($_sortColumn) {
        sort2d($_data, $_sortColumn);
    } elseif ($_groupColumn) {
        sort2d($_data, $_groupColumn, false);
        $_sortColumn = $_groupColumn;
    }
    $class = empty($class) ? 'treetable' : $class;
    // treetable
    /*
    	if ($prefs['feature_jquery_tablesorter'] == 'y' && strpos($class, 'sortable') === false) {
    		 //$class .= ' sortable';
    	}
    */
    if ($_listFilter == 'y' && count($_data) > $_filterMinRows) {
        $smarty->loadPlugin('smarty_function_listfilter');
        $html .= smarty_function_listfilter(array('id' => $id . '_filter', 'selectors' => "#{$id} tbody tr", 'parentSelector' => "#{$id} .collapsed, #{$id} .expanded", 'exclude' => ".subHeader"), $smarty);
    }
    if ($_openall == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $html .= '&nbsp;<label id="' . $id . '_openall">' . smarty_function_icon(array('_id' => 'folder', 'title' => tra('Toggle sections')), $smarty) . ' ' . tra('Toggle sections') . '</label>';
        $headerlib->add_jq_onready('
$("#' . $id . '_openall").click( function () {
	$this = $(this).modal(" ");
	var img = $("img:first", this)[0];
	if (img.src.indexOf("ofolder.png") > -1) {

		$(".expanded .indenter", "#' . $id . '").eachAsync({
			delay: 20,
			bulk: 0,
			loop: function () {
				$(this).click();
			},
			end: function ()  {
				$this.modal();
			}
		});
		img.src = img.src.replace("ofolder", "folder");
	} else {
		$(".collapsed .indenter", "#' . $id . '").eachAsync({
			delay: 20,
			bulk: 0,
			loop: function () {
				$(this).click();
			},
			end: function ()  {
				$this.modal();
			}
		});
		img.src = img.src.replace("folder", "ofolder");
	}
	return false;
});');
    }
    if ($_showSelected == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $html .= ' <input type="checkbox" id="' . $id . '_showSelected" title="' . tra('Show only selected') . '" />';
        $html .= ' <label for="' . $id . '_showSelected">' . tra('Show only selected') . '</label>';
        $headerlib->add_jq_onready('
$("#' . $id . '_showSelected").click( function () {
	if (!$(this).prop("checked")) {
		$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().show()
	} else {
		$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().hide()
		$("#treetable_1 tr td.checkBoxCell input:checked").parent().parent().show()
	}
});');
    }
    // start writing the table
    $html .= $nl . '<table id="' . $id . '" class="' . $class . '">' . $nl;
    // write the table header
    $html .= '<thead><tr>';
    if (!empty($_checkbox)) {
        $smarty->loadPlugin('smarty_function_select_all');
        for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
            $html .= '<th class="checkBoxHeader">';
            $html .= smarty_function_select_all(array('checkbox_names' => array($_checkbox[$i] . '[]'), 'label' => empty($_checkboxTitles) ? '' : htmlspecialchars($_checkboxTitles[$i]), 'hidden_too' => $_selectAllHiddenToo), $smarty);
            $html .= '</th>';
        }
    }
    foreach ($_columns as $column => $columnName) {
        $html .= '<th>';
        $html .= htmlspecialchars($columnName);
        $html .= '</th>';
    }
    $html .= '</tr></thead>' . $nl;
    $html .= '<tbody>' . $nl;
    $treeSectionsAdded = array();
    $rowCounter = 1;
    // for each row
    foreach ($_data as &$row) {
        // set up tree hierarchy
        if ($_sortColumn) {
            $treeType = htmlspecialchars(trim($row[$_sortColumn]));
            $childRowClass = '';
            if (!empty($_sortColumnDelimiter)) {
                // nested
                $parts = array_reverse(explode($_sortColumnDelimiter, $treeType));
                for ($i = 0, $icount_parts = count($parts); $i < $icount_parts; $i++) {
                    $part = preg_replace('/\\s+/', '_', $parts[$i]);
                    if (in_array($part, $treeSectionsAdded) && $i > 0) {
                        $treeParentId = preg_replace('/\\s+/', '_', $parts[$i]);
                        $tt_parent_id = $id . '_' . $treeParentId;
                        break;
                    } else {
                        $tt_parent_id = '';
                    }
                }
                $treeTypeId = preg_replace('/\\s+/', '_', $parts[0]);
                $tt_id = $id . '_' . $treeTypeId;
                $treeSectionsAdded[] = $treeTypeId;
            } else {
                $treeTypeId = preg_replace('/\\s+/', '_', $treeType);
                $tt_parent_id = $id . '_' . $treeTypeId;
                $tt_id = 'child_of_' . $id . '_' . $treeTypeId . '_' . $oddEvenCounter;
                if (!empty($treeType) && !in_array($treeTypeId, $treeSectionsAdded)) {
                    $html .= '<tr data-tt-id="' . $tt_parent_id . '"><td colspan="' . (count($_columns) + count($_checkbox)) . '">';
                    $html .= $treeType . '</td></tr>' . $nl;
                    // Courtesy message to help category perms configurators
                    if ($treeType == 'category') {
                        $html .= '<tr class="' . $childRowClass . '" data-tt-parent-id="' . $tt_parent_id . '" data-tt-id="cat_subHeader_' . $rowCounter . '">' . '<td colspan="' . (count($_columns) + count($_checkbox)) . '">';
                        $html .= '<em>' . tra('You might want to also set the tiki_p_modify_object_categories permission under the tiki section') . '</em></td></tr>' . $nl;
                    }
                    $treeSectionsAdded[] = $treeTypeId;
                    // write a sub-header
                    $html .= '<tr data-tt-id="subHeader_' . $rowCounter . '" data-tt-parent-id="' . $tt_parent_id . '" class="subHeader' . $childRowClass . '">';
                    if (!empty($_checkbox)) {
                        for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
                            $html .= '<td class="checkBoxHeader">';
                            $html .= empty($_checkboxTitles) ? '' : htmlspecialchars($_checkboxTitles[$i]);
                            $html .= '</td>';
                        }
                    }
                    foreach ($_columns as $column => $columnName) {
                        $html .= '<td>';
                        $html .= htmlspecialchars($columnName);
                        $html .= '</td>';
                    }
                    $html .= '</tr>' . $nl;
                }
            }
        } else {
            $childRowClass = '';
            $tt_parent_id = '';
            $tt_id = '';
        }
        // work out row class (odd/even etc)
        if ($oddEvenCounter > -1) {
            $rowClass = $_rowClasses[$oddEvenCounter % 2] . $childRowClass;
            $oddEvenCounter++;
        } else {
            $rowClass = $childRowClass;
        }
        $html .= '<tr data-tt-id="' . $tt_id . '"' . (!empty($tt_parent_id) ? ' data-tt-parent-id="' . $tt_parent_id . '"' : '') . ' class="' . $rowClass . '">';
        // add the checkbox
        if (!empty($_checkbox)) {
            for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
                // get checkbox's "value"
                $cbxVal = htmlspecialchars($row[$_checkboxColumnIndex[$i]]);
                $rowVal = htmlspecialchars($row[$_valueColumnIndex]);
                $cbxTit = empty($_checkboxTitles) ? $cbxVal : htmlspecialchars($_checkboxTitles[$i]);
                $html .= '<td class="checkBoxCell" style="white-space: nowrap;">';
                $html .= '<input type="checkbox" name="' . htmlspecialchars($_checkbox[$i]) . '[]" value="' . $rowVal . '"' . ($cbxVal == 'y' ? ' checked="checked"' : '') . ' title="' . $cbxTit . '" />';
                if ($cbxVal == 'y') {
                    $html .= '<input type="hidden" name="old_' . htmlspecialchars($_checkbox[$i]) . '[]" value="' . $rowVal . '" />';
                }
                $html .= '</td>';
            }
        }
        foreach ($_columns as $column => $columnName) {
            $html .= '<td>';
            if ($_columnsContainHtml != 'y') {
                $html .= htmlspecialchars($row[$column]);
            } else {
                $html .= $row[$column];
            }
            $html .= '</td>' . $nl;
        }
        $html .= '</tr>' . $nl;
        $rowCounter++;
    }
    $html .= '</tbody></table>' . $nl;
    // add jq code to initial treetable
    $expanable = empty($_sortColumnDelimiter) ? 'true' : 'false';
    // when nested, clickableNodeNames is really annoying
    if (count($treeSectionsAdded) < $_collapseMaxSections) {
        $headerlib->add_jq_onready('$("#' . $id . '").treetable({clickableNodeNames:' . $expanable . ',initialState: "expanded", expandable:true});');
    } else {
        $headerlib->add_jq_onready('$("#' . $id . '").treetable({clickableNodeNames:' . $expanable . ',initialState: "collapsed", expandable:true});');
    }
    // TODO refilter when .parent is opened - seems to prevent the click propagating
    //		$headerlib->add_jq_onready('$("tr.parent").click(function(event) {
    //if ($("#'.$id.'_filter").val()) {
    //	$("#'.$id.'_filter").trigger("keyup");
    //	if (event.isPropagationStopped() || event.isImmediatePropagationStopped()) {
    //		$(this).trigger("click");
    //	}
    //}
    //		});');
    return $html;
}
Exemplo n.º 2
0
        if ($stats[wins] == 0 || $i > 3) {
            break;
        }
        echo '			' . $i . '. ' . $stats[name] . ' - ' . $stats[wins] . ($stats[wins] > 1 ? ' wins' : ' win') . '<br />';
        $tmpWins = $stats[wins];
        //set last # wins
    }
    echo '		</div>' . "\n";
}
$tmpScore = 0;
$i = 1;
if (is_array($playerTotals) && sizeof($playerTotals) > 0) {
    //show top 3 pick ratios
    echo '		<div class="bg-success">' . "\n";
    echo '			<b>Current Leaders (pick %):</b><br />' . "\n";
    $playerTotals = sort2d($playerTotals, 'score', 'desc');
    foreach ($playerTotals as $playerID => $stats) {
        if ($tmpScore < $stats[score]) {
            $tmpScore = $stats[score];
        }
        //set initial top score
        //if next lowest score is reached, increase counter
        if ($stats[score] < $tmpScore) {
            $i++;
        }
        //if score is zero or counter is 3 or higher, break
        if ($stats[score] == 0 || $i > 3) {
            break;
        }
        $pickRatio = $stats[score] . '/' . $possibleScoreTotal;
        $pickPercentage = number_format($stats[score] / $possibleScoreTotal * 100, 2) . '%';
Exemplo n.º 3
0
 /**
  * Get a list of members who are explicitly allowed to view the given conversation.
  * Only members who have been explicitly added to the members allowed list will be returned;
  * this function returns an empty array for non-private conversations.
  *
  * @see getMembersAllowedSummary() for an effective list of members/groups who are allowed to view
  * 		a conversation (which takes channel permissions into consideration.)
  * @param array The conversation details.
  * @return array An array of entities allowed. Each entry is an array with the following elements:
  * 		type: can be either 'member' or 'group'
  * 		id: the ID of the entity (memberId or groupId)
  * 		name: the name of the entity
  * 		avatarFormat: the member's avatarFormat field (not relevant for groups)
  * 		groups: an array of groups which the member is in (not relevant for groups)
  */
 public function getMembersAllowed($conversation)
 {
     $membersAllowed = array();
     // If the conversation is not private, then everyone can view it - return an empty array.
     if (!$conversation["private"] and $conversation["conversationId"]) {
         return $membersAllowed;
     }
     // Construct separate queries for getting a list of the members and groups allowed in a conversation.
     // We will marry these later on.
     $qMembers = ET::SQL()->select("'member'", "type")->select("CAST(" . ($conversation["conversationId"] ? "s.id" : "m.memberId") . " AS SIGNED)")->select("m.username")->select("m.avatarFormat")->select("m.account")->select("GROUP_CONCAT(g.groupId)")->groupBy("m.memberId");
     $qGroups = ET::SQL()->select("'group'", "type")->select("s.id", "id")->select("g.name")->select("NULL")->select("NULL")->select("NULL");
     // If the conversation doesn't exist, the members allowed are in stored in the session.
     // We'll have to get details from the database using the IDs stored in the session.
     if (!$conversation["conversationId"]) {
         $groups = $members = array();
         $sessionMembers = (array) ET::$session->get("membersAllowed");
         foreach ($sessionMembers as $member) {
             if ($member["type"] == "group") {
                 // The adminisrtator/member groups aren't really groups, so we can't query the database
                 // for their information. Instead, add them to the members allowed array manually.
                 if ($member["id"] == GROUP_ID_ADMINISTRATOR or $member["id"] == GROUP_ID_MEMBER) {
                     if ($member["id"] == GROUP_ID_ADMINISTRATOR) {
                         $name = ACCOUNT_ADMINISTRATOR;
                     } elseif ($member["id"] == GROUP_ID_MEMBER) {
                         $name = ACCOUNT_MEMBER;
                     }
                     $membersAllowed[] = array("type" => "group", "id" => $member["id"], "name" => $name, "avatarFormat" => null, "groups" => null);
                 } else {
                     $groups[] = $member["id"];
                 }
             } else {
                 $members[] = $member["id"];
             }
         }
         if (!count($members)) {
             $members[] = null;
         }
         if (!count($groups)) {
             $groups[] = null;
         }
         // Get member details directly from the members table, and the group details directly from the groups table.
         $qMembers->from("member m")->where("m.memberId IN (:memberIds)")->bind(":memberIds", $members);
         $qGroups->select("g.groupId", "id")->from("group g")->where("g.groupId IN (:groupIds)")->bind(":groupIds", $groups);
     } else {
         $qMembers->from("member_conversation s")->from("member m", "s.id=m.memberId", "left")->where("s.conversationId=:conversationId")->bind(":conversationId", $conversation["conversationId"])->where("s.allowed=1")->where("s.type='member'");
         $qGroups->from("member_conversation s")->from("group g", "s.id=g.groupId", "left")->where("s.conversationId=:conversationId")->bind(":conversationId", $conversation["conversationId"])->where("s.allowed=1")->where("s.type='group'");
     }
     // Any objections?
     $qMembers->from("member_group g", "m.memberId=g.memberId", "left");
     // You may now kiss the bride.
     $result = ET::SQL("(" . $qMembers->get() . ") UNION (" . $qGroups->get() . ")");
     // Go through the results and construct our final "members allowed" array.
     while ($entity = $result->nextRow()) {
         list($type, $id, $name, $avatarFormat, $account, $groups) = array_values($entity);
         $groups = ET::groupModel()->getGroupIds($account, explode(",", $groups));
         if ($type == "group") {
             if ($id == GROUP_ID_ADMINISTRATOR) {
                 $name = ACCOUNT_ADMINISTRATOR;
             } elseif ($id == GROUP_ID_MEMBER) {
                 $name = ACCOUNT_MEMBER;
             }
         }
         $membersAllowed[] = array("type" => $type, "id" => $id, "name" => $name, "avatarFormat" => $avatarFormat, "groups" => $groups);
     }
     // Sort the entities by name.
     $membersAllowed = sort2d($membersAllowed, "name", "asc", true, false);
     return $membersAllowed;
 }
Exemplo n.º 4
0
 public function executeDailyLog(sfWebRequest $request)
 {
     $this->form = new ReportDailyLogForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $month = $this->form->getValue('date_month');
             $this->year = $year = $this->form->getValue('date_year');
             $first_day = mktime(0, 0, 0, $month, 1, $year);
             $last_day = strtotime('+1 month -1 second', $first_day);
             $c = new Criteria();
             // only in this date range (the month selected)
             $c->add(NoteEntryPeer::SERVICE_DATE, $first_day, Criteria::GREATER_EQUAL);
             $c->addAnd(NoteEntryPeer::SERVICE_DATE, $last_day, Criteria::LESS_EQUAL);
             // include absent? lets go with no
             $c->add(NoteEntryPeer::ABSENT, 0);
             // sort by kids name
             $c->addAscendingOrderByColumn(ClientPeer::LAST_NAME);
             $c->addAscendingOrderByColumn(NoteEntryPeer::SERVICE_DATE);
             $c->addAscendingOrderByColumn(NoteEntryPeer::TIME_IN);
             // only the selected type
             if ($this->form->getValue('service_type')) {
                 $c->add(ClientServicePeer::OBJECT_TYPE, $this->form->getValue('service_type'));
             }
             $entries = NoteEntryPeer::doSelectJoinAll($c);
             // build array of all entries in the selected time period indexed by ID
             $this->all_entries = array();
             foreach ($entries as $entry) {
                 $this->all_entries[$entry->getId()] = $entry;
             }
             // build an array of overlaps of client
             $this->overlaps = array();
             $client_entry_times = array();
             $provider_entry_times = array();
             foreach ($this->all_entries as $anEntry) {
                 // skip grouped kids, for now
                 if (!$anEntry->inGroup()) {
                     if (!array_key_exists($anEntry->getEmployeeId(), $provider_entry_times)) {
                         $provider_entry_times[$anEntry->getEmployeeId()] = array();
                     }
                     $provider_entry_times[$anEntry->getEmployeeId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U'));
                 }
                 if (!array_key_exists($anEntry->getClientId(), $client_entry_times)) {
                     $client_entry_times[$anEntry->getClientId()] = array();
                 }
                 $client_entry_times[$anEntry->getClientId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U'));
             }
             // find clients with overlapping times
             foreach ($client_entry_times as $client_id => $client_entries) {
                 $entry_times[$client_id] = sort2d($client_entries, 0);
                 $previous = array(0, 0, 0);
                 foreach ($entry_times[$client_id] as $entry_id => $times) {
                     // this in time happened before previous out time.. we have a overlap
                     if ($times[0] < $previous[1] && $entry_id != $previous[2]) {
                         $this->overlaps[$entry_id] = $previous[2];
                         $this->overlaps[$previous[2]] = $entry_id;
                     }
                     $previous = array($times[0], $times[1], $entry_id);
                 }
             }
             // find providers with overlapping times
             foreach ($provider_entry_times as $client_id => $client_entries) {
                 $entry_times[$client_id] = sort2d($client_entries, 0);
                 $previous = array(0, 0, 0);
                 foreach ($entry_times[$client_id] as $entry_id => $times) {
                     // this in time happened before previous out time.. we have a overlap
                     if ($times[0] < $previous[1] && $entry_id != $previous[2]) {
                         $this->overlaps[$entry_id] = $previous[2];
                         $this->overlaps[$previous[2]] = $entry_id;
                     }
                     $previous = array($times[0], $times[1], $entry_id);
                 }
             }
             // initialize
             $this->classrooms = array();
             //        foreach($this->overlaps as $key => $blah) { echo $key .' => '. $blah->getId() .'<br />'; }
             //        die();
             foreach ($this->all_entries as $entry) {
                 // only kids that have been serviced by this employee
                 if (!$this->form->getValue('employee_id') || $this->form->getValue('employee_id') == $entry->getEmployeeId()) {
                     $office = $entry->getOffice();
                     $client = $entry->getClient();
                     $week = $entry->getServiceDate('W');
                     if (!is_object($office)) {
                         $office = new Office();
                         $office->setName('N/A');
                     }
                     // let's see if we have entered any for this classroom yet
                     if (!array_key_exists($office->getName(), $this->classrooms)) {
                         $this->classrooms[$office->getName()] = array_fill_keys(range(date('W', $first_day), date('W', $last_day)), array());
                     }
                     // initialize the row for this kid
                     if (!array_key_exists($week, $this->classrooms[$office->getName()]) || !array_key_exists($client->getFullName(), $this->classrooms[$office->getName()][$week])) {
                         $days = array();
                         for ($day = 1; $day <= 5; $day++) {
                             $days[date('m/d/Y', strtotime($entry->getServiceDate('Y') . "W" . $week . $day))] = array();
                         }
                         $this->classrooms[$office->getName()][$week][$client->getFullName()] = $days;
                     }
                     // save the entry to the appropriate cell in the table
                     $this->classrooms[$office->getName()][$week][$client->getFullName()][$entry->getServiceDate('m/d/Y')][] = $entry;
                 }
             }
             //        $weeks = array(
             //            'week_num' => array(
             //                'client_name' => array(
             //                    'date' => array(
             //                        'service_type' => 'cell data, time, absent, etc.'
             //                    )
             //                )
             //            )
             //        );
             return 'Report';
         }
     }
 }
Exemplo n.º 5
0
        $dc->GetDataCenter();
        $dctemp[$DataCenterID] = $dc->Name;
    }
}
/*  SORT ALL THE THINGS!  */
// Sort the dc list
if (!empty($dctemp)) {
    natcasesort($dctemp);
}
// Sort cabinet array
if (!empty($cabtemp)) {
    $cabtemp = sort2d($cabtemp, 'name');
}
// Sort array based on device label
if (!empty($temp)) {
    $devList = sort2d($temp, 'label');
} else {
    // it's possible to have cdu's and cabinets in the search results and no devices
    // this will clear the devList in case it contained special devices
    $devList = array();
}
if ($resultcount > 0) {
    $searchresults = sprintf(__("Search complete. (%s) results."), "<span id=\"resultcount\">{$resultcount}</span>");
} else {
    $searchresults = __("No matching devices found.");
}
// if json is set then return the device list as a json string
if (isset($_REQUEST['json'])) {
    header('Content-Type: application/json');
    echo json_encode($devList);
    exit;
 function organizePages()
 {
     $CI =& get_instance();
     $CI->load->helper("array");
     $array = sort2d($this->fields, "page");
     /*
     for($i=0;$i<count($this->fields);$i++) {
     	if ($this->fields[$i]["page"] == "")
     }
     */
 }
Exemplo n.º 7
0
//echo $q;
$process = odbc_exec($connection_string, $q);
while (odbc_fetch_row($process)) {
    $refCount = odbc_result($process, "refCount");
}
//echo $refCount;
odbc_close($connection_string);
//Get Agent Count By Referrals Scheduled
$q2 = "exec usp_USI_getReferralsSchedByAgent " . $_GET['employergroup'] . ", '" . $_GET['fromDate'] . "', '" . $_GET['thruDate'] . "'";
$pr = odbc_exec($connection_string, $q2);
while (odbc_fetch_row($pr)) {
    $agent_arr[] = array('referral_ud' => odbc_result($pr, "referral_ud"), 'agent' => odbc_result($pr, "os_user_name"), 'sched_date' => odbc_result($pr, "scheduled_date"));
    $schedCount++;
}
//print_r($agent_arr);
$sorted_agent_arr = sort2d($agent_arr, "agent");
//print_r($sorted_agent_arr);
$agent_count = 1;
for ($i = 0; $i < count($sorted_agent_arr); $i++) {
    $curr_agent = $sorted_agent_arr[$i]["agent"];
    $next_agent = $sorted_agent_arr[$i + 1]["agent"];
    if ($curr_agent == $next_agent) {
        $agent_count++;
    } else {
        //New Agent, reset Count to 1 and store the count and agent in an array
        $count_arr[] = array('agent' => $curr_agent, 'count' => $agent_count);
        $agent_count = 1;
    }
}
//print_r($count_arr);
$tr = "tr0";