Skip to content

Instantly share code, notes, and snippets.

View oojacoboo's full-sized avatar

Jacob Thomason oojacoboo

View GitHub Profile
$json['title'] = "Documents JSON";
$json['description'] = "All the documents per company";
$json['generator'] = "https://xxxxx.com/";
$json['documents'] = array();
foreach($docs as $doc) {
Debug::toLog($doc->getId());
$json['documents'][$doc->getId()]['id'] = $doc->getId();
$json['documents'][$doc->getId()]['groupId'] = $doc->getDocumentGroupId();
/**
* Flashes a color over the element for a duration of time
* @param flashColor
* @param duration
*/
flash: function(flashColor, duration) {
var flashBackground = flashColor || "#f2ffed",
animateMs = duration || 1500;
this.stop()
/**
* Flashes a color over the element for a duration of time
* @param flashColor
* @param duration
*/
flash: function(flashColor, duration) {
var flashBackground = flashColor || "#f2ffed",
animateMs = duration || 1500;
this.stop()
$.fn.setupFilterInput = function(callback) {
var $input = $(this),
$searchX = $input.parent().find("#x-icon");
$input.focus(function(event) {
if(this.value == $input.prop("placeholder"))
this.value = "";
}).blur(function(event) {
if(!this.value || this.value == "")
//this sets up the entire filter-bar defaults with events
$search.setupPlaceHolder()
.setupFilterInput(function(event) {
dPager.search = event.target.value;
})
.setupFilterOptions(function(event) {
dPager.filterGroup = $(event.target).data("group-id");
});
/**
* Documents Pagination Class
* @param containerEl
* @constructor
*/
function DocumentsPager(containerEl) {
this.containerEl = containerEl;
this.jsonLoaded = false;
this.json = null;
this.searchQuery = "";
@oojacoboo
oojacoboo / actions.class.php
Created December 20, 2012 07:50
json_encode array
$json['title'] = "Documents JSON";
$json['description'] = "All the documents per company";
$json['generator'] = "https://xxxxx.com/";
$json['documents'] = array();
foreach($docs as $doc) {
$json['documents'][] = array(
'id' => $doc->getId(),
'groupId' => $doc->getDocumentGroupId(),
'groupName' => $doc->getDocumentGroup()->getName(),
$json['title'] = "Documents JSON";
$json['description'] = "All the documents per company";
$json['generator'] = "https://xxxxx.com/";
$json['documents'] = array();
foreach($docs as $key => $doc) {
$json['documents'][] = array(
'id' => $doc->getId(),
'groupId' => $doc->getDocumentGroupId(),
'groupName' => $doc->getDocumentGroup()->getName(),
this.searchedJson.documents = _.filter(this.json.documents, function(doc) {
return (
_.isArray(doc.nickname.match(searchRegExp))
|| _.isArray(doc.docRelations[].firstName.match(searchRegExp)) //array
);
});
/**
* Documents Pagination Class
* @param containerEl
* @constructor
*/
function DocumentsPager(containerEl) {
this.containerEl = containerEl;
this.template = _.template($("#documents-template").html());
this.jsonLoaded = false;
this.json = null;