Skip to content

Instantly share code, notes, and snippets.

View markphi2013's full-sized avatar

Mark markphi2013

  • Kampala, Uganda
View GitHub Profile
@markphi2013
markphi2013 / basic.css
Created March 22, 2013 15:04
css validation Bug on dialogue and request
.ttc-validation-error {
position: absolute;
left: -700px;
top: -50px;
top: -35px\9;
background: pink;
border: solid white;
padding: 5px;
font-size: 12px;
}
@markphi2013
markphi2013 / StatsComponent
Last active December 19, 2015 15:18
hello, Can you help me out with the loop for the rediskey in the public function getProgramStats($program)
StatsComponent<?php
App::uses('Component', 'Controller');
App::uses('Program', 'Model');
class StatsComponent extends Component {
public function getRedis()
{
$redis = new Redis();
$redis->connect('127.0.0.1');
@markphi2013
markphi2013 / statsCompontent v2
Created July 12, 2013 11:45
i working on this with Gerald and seems to work well with the saving to redis and getting the values from there
<?php
App::uses('Component', 'Controller');
App::uses('Program', 'Model');
class StatsComponent extends Component {
public function getRedis()
{
$redis = new Redis();
$redis->connect('127.0.0.1');
<?php
App::uses('Component', 'Controller');
App::uses('Program', 'Model');
App::uses('ProgramSetting', 'Model');
class StatsComponent extends Component {
public $Controller = null;
public $redis = null;
<?php
echo $this->Html->tag(
'div',
'<b title = "'.__('Optin / Total participant(s)').'">'.$program['Program']['stats']['active-participant-count'].'/'.
$program['Program']['stats']['participant-count'].'</b> '.__(' participant(s)').'<br/>'.
'<b title = "'.__('Total (total current month) message(s)').'">'.$program['Program']['stats']['history-count'].'('.
$program['Program']['stats']['total-current-month-messages-count'].') </b>'.__(' total message(s)').'<br/>'.
'<b title = "'.__('Total (current month) received - Total(current month) sent').'">'.$program['Program']['stats']['all-received-messages-count'].'('.
$program['Program']['stats']['current-month-received-messages-count'].') </b>'.__('received').
' - <b title = "'.__('Total (current month) received - Total (current month) sent').'">'.$program['Program']['stats']['all-sent-messages-count'].'('.
@markphi2013
markphi2013 / get_program_stats
Created September 13, 2013 11:30
programstats ajax
<?php
echo $this->Js->object();
?>
the out put is "[ ]"
@markphi2013
markphi2013 / ProgramsController.php
Created September 16, 2013 10:27
programController test for program stats
public function getProgramStats()
{
if(isset($this->params['url']['program'])){
$programUrl = $this->Program->find('first', array('conditions' => array('url'=> $this->params['url']['program'])));
$programStats = $this->Stats->getProgramStats($programUrl['Program']['database']);
$this->set(compact('programStats'));
}
}
function loadProgramStats(){
var programs = window.app.programs;
if(programs !== null){
var program = {};
for(var i = 0; i< programs.length; i++){
program = programs[i];
var programUrl = program['Program']['url'];
$.ajax({
type: "GET",
dataType: "json",
public function getProgramStats()
{
$user = $this->Auth->user();
if(isset($this->params['url']['program'])){
$programUrls = $this->Program->find('authorized', array(
'specific_program_access' => 'true',
'user_id' => $user['id'],
'conditions' => array('url'=> $this->params['url']['program'])));
foreach($programUrls as $programUrl)
$programDatabase = $programUrl['Program']['database'];
@markphi2013
markphi2013 / k.js
Created September 25, 2013 13:03
inlineif
function generateHtmlProgramStats(programStats) {
var myTemplate = ((programStats != null)?
'<div>'+
'<span title = "Optin/Total participant(s)" class=stat>'+
'Activeparticipant/Totalparticipantstats'+
'</span> participant(s)'+
'</div>'+
'<div>'+
'<span title = "Total(total currentmonth) message(s)" class=stat>'+
'Totalhistory(Totalcurrentmonthmessages)'+