/**
  * Return manager instance
  *
  * @access protected
  * @param void
  * @return Workspaces 
  */
 function manager()
 {
     if (!$this->manager instanceof Workspaces) {
         $this->manager = Workspaces::instance();
     }
     return $this->manager;
 }
Beispiel #2
0
	/**
	 * Feng2 Plugin update engine 
	 * @author Ignacio Vazquez <elpepe.uy at gmail.com>
	 */
	function workspaces_update_1_2() {
		$workspaces = Workspaces::findAll();
		if (!is_array($workspaces)) return;
		foreach ($workspaces as $ws){
			if ($ws instanceof ContentDataObject) {
				$ws->addToSearchableObjects(1);
			}
			$ws->addToSharingTable();
		}
	}
function workspaces_render_widget_member_information(Member $member, &$prop_html = "")
{
    $ws_ot = ObjectTypes::findByName('workspace');
    if ($member->getObjectTypeId() == $ws_ot->getId()) {
        $ws = Workspaces::getWorkspaceById($member->getObjectId());
        if ($ws instanceof Workspace && trim($member->getDescription()) != "" && $ws->getColumnValue('show_description_in_overview')) {
            $prop_html .= '<div style="margin-bottom:5px;">' . escape_html_whitespace(convert_to_links(clean($member->getDescription()))) . '</div>';
        }
    }
}
function workspaces_override_member_color($member, &$color) {
	
	$ws_ot = ObjectTypes::findByName('workspace');
	if (!$ws_ot instanceof ObjectType) return;
	
	if ($member->getObjectTypeId() == $ws_ot->getId()) {
		$ws = Workspaces::getWorkspaceById($member->getObjectId());
		if ($ws instanceof Workspace) {
			$color = $ws->getColumnValue('color');
		}
	}
}
 static function getWorkspaceColor($ws_id) {
 	
 	if (self::$color_cache == null) {
 		$res = DB::execute("SELECT object_id, color FROM ".TABLE_PREFIX. "workspaces");
 		$rows = $res->fetchAll();
 		if (is_array($rows)) {
 			self::$color_cache = array();
 			foreach ($rows as $row) self::$color_cache[$row['object_id']] = $row['color'];
 		}
 	}
 	
 	return array_var(self::$color_cache, $ws_id);
 }
Beispiel #6
0
$limit = 5;
$genid = gen_id();
$ws_dimension = Dimensions::findByCode('workspaces');
$dim_controller = new DimensionController();
$selected_ws = '0';
$allowed_members = array();
$add_ctx_members = true;
$show_widget = true;
$context = active_context();
if (isset($context)) {
    foreach ($context as $selection) {
        if ($selection instanceof Dimension && $selection->getCode() == 'workspaces') {
            $add_ctx_members = false;
        } else {
            if ($selection instanceof Member) {
                if ($selection->getObjectTypeId() == Workspaces::instance()->getObjectTypeId()) {
                    $allowed_members[] = $selection->getId();
                    $selected_ws = $selection->getId();
                } else {
                    $show_widget = false;
                }
            }
        }
    }
}
if ($show_widget) {
    $extra_conditions = " AND parent_member_id " . ($add_ctx_members && count($allowed_members) > 0 ? "IN (" . implode(",", $allowed_members) . ")" : "=0");
    $parent = null;
    $context = active_context();
    if (is_array($context)) {
        foreach ($context as $selection) {
Beispiel #7
0
<?php

$total = 5;
$genid = gen_id();
$workspaces = Workspaces::getWorkspaces(10);
$data_ws = array();
foreach ($workspaces as $ws) {
    if (count($data_ws) < $total) {
        $data_ws[] = $ws;
    }
}
include_once 'template.php';
Beispiel #8
0
			
			var name = $(container).find("input.ws-name").val();

			if (name) {
				og.quickAddWs({
					name: name,
					parent: '<?php 
echo $members;
?>
',
					dim_id: '<?php 
echo $ws_dim->getId();
?>
',
					ot_id: '<?php 
echo Workspaces::instance()->getObjectTypeId();
?>
'
				},function(){
					og.customDashboard('dashboard', 'main_dashboard',{},true);
				});
				
			}else{
				alert('<?php 
echo lang('name required');
?>
');
				$(container).find("input.add-project-field").focus();
				container.removeClass("loading");
			}	
			
 /**
 * Return manager instance
 *
 * @access protected
 * @param void
 * @return Workspaces 
 */
 function manager() {
   if(!($this->manager instanceof Workspaces)) $this->manager = Workspaces::instance();
   return $this->manager;
 } // manager
 /**
  * Delete rows that match specific conditions. If $conditions is NULL all rows from table will be deleted
  *
  * @access public
  * @param string $conditions Query conditions
  * @return boolean
  */
 function delete($condition = null)
 {
     if (isset($this) && instance_of($this, 'Workspaces')) {
         return parent::delete($condition);
     } else {
         return Workspaces::instance()->delete($condition);
     }
     // if
 }
Beispiel #11
0
<?php

$genid = gen_id();
$typeId = ObjectTypes::instance()->findByName("workspace")->getId();
//Check if There is a workspace in the active context
/* @var $member Member */
foreach (active_context_members(false) as $memberId) {
    $member = Members::instance()->findById($memberId);
    if ($member->getObjectTypeId() == $typeId) {
        $id = $member->getObjectId();
        if ($workspace = Workspaces::instance()->findById($id) && trim($member->getDescription()) != "") {
            $description = $member->getDescription();
            include_once 'template.php';
            break;
        }
    }
}
Beispiel #12
0
<?php 
	$genid = gen_id();
	$id = get_id();
	$typeId= ObjectTypes::instance()->findByName("workspace")->getId();
	
	//Check if There is a workspace in the active context
	/* @var $member Member */ 
	foreach (active_context_members(false) as $memberId){
		$member = Members::instance()->findById($memberId);
		if ( $member->getObjectTypeId() == $typeId ) {
			$id = $member->getObjectId();
			
			if ($workspace = Workspaces::instance()->findById($id) ){
				if ( $workspace->getDescription() ) {
					include_once 'template.php';
				}
				break ;
			}
		} 
	}
	
Beispiel #13
0
 function getIconClass() {
 	
 	if ($this->isLoaded()) {
 		$colorCode = $this->getColumnValue("color");
 	}else{
 		if ($id = $this->getId()) {
 			$colorCode = Workspaces::getWorkspaceColor($id);
 		}
 	}
 	if ( isset($colorCode) ) {
 		return "ico-color".$colorCode;
 	}else{
 		return "ico-color0";	
 	}
 }
Beispiel #14
0
<?php
$total = 5;
$genid = gen_id();

$ws_dimension = Dimensions::findByCode('workspaces');
$dim_controller = new DimensionController();

$selected_ws = '0';
$allowed_members = array();
$add_ctx_members = true;
$context = active_context();
if(isset($context)){
	foreach ($context as $selection) {
		if ($selection instanceof Dimension && $selection->getCode() == 'workspaces') {
			$add_ctx_members = false;
		} else if ($selection instanceof Member && $selection->getObjectTypeId() == Workspaces::instance()->getObjectTypeId()) {
			$allowed_members[] = $selection->getId();
			$selected_ws = $selection->getId();
		}
	}	
}

$extra_conditions = " AND parent_member_id " . ($add_ctx_members && count($allowed_members) > 0 ? "IN (". implode(",", $allowed_members) .")" : "=0");

$workspaces = $dim_controller->initial_list_dimension_members($ws_dimension->getId(), null, null, false, $extra_conditions, $total, true);

$parent = null;
$context = active_context();
foreach ($context as $selection) {
	if ($selection instanceof Member && $selection->getDimensionId() == $ws_dimension->getId()) {
		$parent = $selection;