当前位置: 首页>>代码示例>>PHP>>正文


PHP CustomProperties::getAllCustomPropertiesByObjectType方法代码示例

本文整理汇总了PHP中CustomProperties::getAllCustomPropertiesByObjectType方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomProperties::getAllCustomPropertiesByObjectType方法的具体用法?PHP CustomProperties::getAllCustomPropertiesByObjectType怎么用?PHP CustomProperties::getAllCustomPropertiesByObjectType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CustomProperties的用法示例。


在下文中一共展示了CustomProperties::getAllCustomPropertiesByObjectType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_custom_properties

 function get_custom_properties()
 {
     $object_type = array_var($_GET, 'object_type');
     if ($object_type) {
         $cp = CustomProperties::getAllCustomPropertiesByObjectType($object_type);
         $customProperties = array();
         foreach ($cp as $custom) {
             $prop = array();
             $prop['id'] = $custom->getId();
             $prop['name'] = $custom->getName();
             $prop['object_type'] = $custom->getObjectTypeId();
             $prop['description'] = $custom->getDescription();
             $prop['type'] = $custom->getType();
             $prop['values'] = $custom->getValues();
             $prop['default_value'] = $custom->getDefaultValue();
             $prop['required'] = $custom->getIsRequired();
             $prop['multiple_values'] = $custom->getIsMultipleValues();
             $prop['visible_by_default'] = $custom->getVisibleByDefault();
             $prop['co_types'] = '';
             //CustomPropertiesByCoType::instance()->getCoTypesIdsForCpCSV($custom->getId());
             $customProperties[] = $prop;
         }
         ajx_current("empty");
         ajx_extra_data(array("custom_properties" => $customProperties));
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:26,代码来源:PropertyController.class.php

示例2: get_allowed_columns

 private function get_allowed_columns($object_type)
 {
     $fields = array();
     if (isset($object_type)) {
         $customProperties = CustomProperties::getAllCustomPropertiesByObjectType($object_type);
         $objectFields = array();
         foreach ($customProperties as $cp) {
             if ($cp->getType() == 'table') {
                 continue;
             }
             $fields[] = array('id' => $cp->getId(), 'name' => $cp->getName(), 'type' => $cp->getType(), 'values' => $cp->getValues(), 'multiple' => $cp->getIsMultipleValues());
         }
         $ot = ObjectTypes::findById($object_type);
         eval('$managerInstance = ' . $ot->getHandlerClass() . "::instance();");
         $objectColumns = $managerInstance->getColumns();
         $objectFields = array();
         $objectColumns = array_diff($objectColumns, $managerInstance->getSystemColumns());
         foreach ($objectColumns as $column) {
             $objectFields[$column] = $managerInstance->getColumnType($column);
         }
         $common_columns = Objects::instance()->getColumns(false);
         $common_columns = array_diff_key($common_columns, array_flip($managerInstance->getSystemColumns()));
         $objectFields = array_merge($objectFields, $common_columns);
         foreach ($objectFields as $name => $type) {
             if ($type == DATA_TYPE_FLOAT || $type == DATA_TYPE_INTEGER) {
                 $type = 'numeric';
             } else {
                 if ($type == DATA_TYPE_STRING) {
                     $type = 'text';
                 } else {
                     if ($type == DATA_TYPE_BOOLEAN) {
                         $type = 'boolean';
                     } else {
                         if ($type == DATA_TYPE_DATE || $type == DATA_TYPE_DATETIME) {
                             $type = 'date';
                         }
                     }
                 }
             }
             $field_name = Localization::instance()->lang('field ' . $ot->getHandlerClass() . ' ' . $name);
             if (is_null($field_name)) {
                 $field_name = lang('field Objects ' . $name);
             }
             $fields[] = array('id' => $name, 'name' => $field_name, 'type' => $type);
         }
         $externalFields = $managerInstance->getExternalColumns();
         foreach ($externalFields as $extField) {
             $field_name = Localization::instance()->lang('field ' . $ot->getHandlerClass() . ' ' . $extField);
             if (is_null($field_name)) {
                 $field_name = lang('field Objects ' . $extField);
             }
             $fields[] = array('id' => $extField, 'name' => $field_name, 'type' => 'external', 'multiple' => 0);
         }
         if (!array_var($_REQUEST, 'noaddcol')) {
             Hook::fire('custom_reports_additional_columns', null, $fields);
         }
     }
     usort($fields, array(&$this, 'compare_FieldName'));
     return $fields;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:60,代码来源:ReportingController.class.php

示例3: list_all


//.........这里部分代码省略.........
					try {
						$webpage->setIsRead(logged_user()->getId(),true);
						$succ++;
						
					} catch(Exception $e) {						
						$err ++;
					}
				}
			if ($succ <= 0) {
				flash_error(lang("error markasread files", $err));
			}
		} else if (array_var($_GET, 'action') == 'markasunread') {
			$ids = explode(',', array_var($_GET, 'ids'));
			$succ = 0; $err = 0;
				foreach ($ids as $id) {
				$webpage = ProjectWebpages::findById($id);
					try {
						$webpage->setIsRead(logged_user()->getId(),false);
						$succ++;
						
					} catch(Exception $e) {						
						$err ++;
					}
				}
			if ($succ <= 0) {
				flash_error(lang("error markasunread files", $err));
			}
		} else if (array_var($_GET,'action') == 'archive') {
			$ids = explode(',', array_var($_GET, 'webpages'));
			$succ = 0; $err = 0;
			foreach ($ids as $id) {
				$web_page = ProjectWebpages::findById($id);
				if (isset($web_page) && $web_page->canEdit(logged_user())) {
					try{
						DB::beginWork();
						$web_page->archive();
						ApplicationLogs::createLog($web_page, ApplicationLogs::ACTION_ARCHIVE);
						DB::commit();
						$succ++;
					} catch(Exception $e){
						DB::rollback();
						$err++;
					}
				} else {
					$err++;
				}
			}
			if ($succ > 0) {
				flash_success(lang("success archive objects", $succ));
			}
			if ($err > 0) {
				flash_error(lang("error archive objects", $err));
			}
		}
		
		$res =  ProjectWebpages::instance()->listing(array(
			"order" => $order , 
			"order_dir" => $order_dir  
		));
		
		$object = array(
			"totalCount" => $res->total,
			"start" => $start,
			"webpages" => array()
		);
		$custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(ProjectWebpages::instance()->getObjectTypeId());
		if (isset($res->objects)) {
			$index = 0;
			$ids = array();
			foreach ($res->objects as $w) {
				$ids[] = $w->getId();
				$object["webpages"][$index] = array(
					"ix" => $index,
					"id" => $w->getId(),
					"object_id" => $w->getObjectId(),
					"ot_id" => $w->getObjectTypeId(),
					"name" => $w->getObjectName(),
					"description" => $w->getDescription(),
					"url" => $w->getUrl(),
					"updatedOn" => $w->getUpdatedOn() instanceof DateTimeValue ? ($w->getUpdatedOn()->isToday() ? format_time($w->getUpdatedOn()) : format_datetime($w->getUpdatedOn())) : '',
					"updatedOn_today" => $w->getUpdatedOn() instanceof DateTimeValue ? $w->getUpdatedOn()->isToday() : 0,
					"updatedBy" => $w->getUpdatedByDisplayName(),
					"updatedById" => $w->getUpdatedById(),
					"memPath" => json_encode($w->getMembersToDisplayPath()),
				);
				
				foreach ($custom_properties as $cp) {
					$cp_value = CustomPropertyValues::getCustomPropertyValue($w->getId(), $cp->getId());
					$object["webpages"][$index]['cp_'.$cp->getId()] = $cp_value instanceof CustomPropertyValue ? $cp_value->getValue() : '';
				}
				$index++;
			}
			
			$read_objects = ReadObjects::getReadByObjectList($ids, logged_user()->getId());
			foreach($object["webpages"] as &$data) {
				$data['isRead'] = isset($read_objects[$data['object_id']]);
			}
		}
		ajx_extra_data($object);
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:WebpageController.class.php

示例4: cloneTask


//.........这里部分代码省略.........
     if ($copy_status) {
         $new_task->setCompletedById($this->getCompletedById());
         $new_task->setCompletedOn($this->getCompletedOn());
     }
     if ($copy_repeat_options) {
         $new_task->setRepeatEnd($this->getRepeatEnd());
         $new_task->setRepeatForever($this->getRepeatForever());
         $new_task->setRepeatNum($this->getRepeatNum());
         $new_task->setRepeatBy($this->getRepeatBy());
         $new_task->setRepeatD($this->getRepeatD());
         $new_task->setRepeatM($this->getRepeatM());
         $new_task->setRepeatY($this->getRepeatY());
     }
     if ($new_st_date != "") {
         if ($new_task->getStartDate() instanceof DateTimeValue) {
             $new_task->setStartDate($new_st_date);
         }
     }
     if ($new_due_date != "") {
         if ($new_task->getDueDate() instanceof DateTimeValue) {
             $new_task->setDueDate($new_due_date);
         }
     }
     $new_task->save();
     if (is_array($this->getAllLinkedObjects())) {
         foreach ($this->getAllLinkedObjects() as $lo) {
             $new_task->linkObject($lo);
         }
     }
     $sub_tasks = $this->getAllSubTasks();
     foreach ($sub_tasks as $st) {
         $new_dates = $this->getNextRepetitionDatesSubtask($st, $new_task, $new_st_date, $new_due_date);
         if ($st->getParentId() == $this->getId()) {
             $new_st = $st->cloneTask(array_var($new_dates, 'st'), array_var($new_dates, 'due'), $copy_status, $copy_repeat_options, $new_task->getId());
             if ($copy_status) {
                 $new_st->setCompletedById($st->getCompletedById());
                 $new_st->setCompletedOn($st->getCompletedOn());
                 $new_st->save();
             }
             $new_task->attachTask($new_st);
         }
     }
     foreach ($this->getAllComments() as $com) {
         $new_com = new Comment();
         $new_com->setAuthorEmail($com->getAuthorEmail());
         $new_com->setAuthorName($com->getAuthorName());
         $new_com->setAuthorHomepage($com->getAuthorHomepage());
         $new_com->setCreatedById($com->getCreatedById());
         $new_com->setCreatedOn($com->getCreatedOn());
         $new_com->setUpdatedById($com->getUpdatedById());
         $new_com->setUpdatedOn($com->getUpdatedOn());
         $new_com->setText($com->getText());
         $new_com->setRelObjectId($new_task->getId());
         $new_com->save();
     }
     $_POST['subscribers'] = array();
     foreach ($this->getSubscribers() as $sub) {
         $_POST['subscribers']["user_" . $sub->getId()] = "checked";
     }
     $obj_controller = new ObjectController();
     $obj_controller->add_to_members($new_task, $this->getMemberIds());
     $obj_controller->add_subscribers($new_task);
     foreach ($this->getCustomProperties() as $prop) {
         $new_prop = new ObjectProperty();
         $new_prop->setRelObjectId($new_task->getId());
         $new_prop->setPropertyName($prop->getPropertyName());
         $new_prop->setPropertyValue($prop->getPropertyValue());
         $new_prop->save();
     }
     $custom_props = CustomProperties::getAllCustomPropertiesByObjectType("TemplateTasks");
     foreach ($custom_props as $c_prop) {
         $values = CustomPropertyValues::getCustomPropertyValues($this->getId(), $c_prop->getId());
         if (is_array($values)) {
             foreach ($values as $val) {
                 $cp = new CustomPropertyValue();
                 $cp->setObjectId($new_task->getId());
                 $cp->setCustomPropertyId($val->getCustomPropertyId());
                 $cp->setValue($val->getValue());
                 $cp->save();
             }
         }
     }
     $reminders = ObjectReminders::getByObject($this);
     foreach ($reminders as $reminder) {
         $copy_reminder = new ObjectReminder();
         $copy_reminder->setContext($reminder->getContext());
         $reminder_date = $new_task->getColumnValue($reminder->getContext());
         if ($reminder_date instanceof DateTimeValue) {
             $reminder_date = new DateTimeValue($reminder_date->getTimestamp());
             $reminder_date->add('m', -$reminder->getMinutesBefore());
         }
         $copy_reminder->setDate($reminder_date);
         $copy_reminder->setMinutesBefore($reminder->getMinutesBefore());
         $copy_reminder->setObject($new_task);
         $copy_reminder->setType($reminder->getType());
         $copy_reminder->setUserId($reminder->getUserId());
         $copy_reminder->save();
     }
     return $new_task;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:101,代码来源:TemplateTask.class.php

示例5: cloneTask

 function cloneTask($copy_status = false)
 {
     $new_task = new ProjectTask();
     $new_task->setParentId($this->getParentId());
     $new_task->setTitle($this->getTitle());
     $new_task->setText($this->getText());
     $new_task->setAssignedToCompanyId($this->getAssignedToCompanyId());
     $new_task->setAssignedToUserId($this->getAssignedToUserId());
     $new_task->setAssignedOn($this->getAssignedOn());
     $new_task->setAssignedById($this->getAssignedById());
     $new_task->setTimeEstimate($this->getTimeEstimate());
     $new_task->setStartedOn($this->getStartedOn());
     $new_task->setStartedById($this->getStartedById());
     $new_task->setPriority($this->getPriority());
     $new_task->setState($this->getState());
     $new_task->setOrder($this->getOrder());
     $new_task->setMilestoneId($this->getMilestoneId());
     $new_task->setIsPrivate($this->getIsPrivate());
     $new_task->setIsTemplate($this->getIsTemplate());
     $new_task->setFromTemplateId($this->getFromTemplateId());
     if ($this->getDueDate() instanceof DateTimeValue) {
         $new_task->setDueDate(new DateTimeValue($this->getDueDate()->getTimestamp()));
     }
     if ($this->getStartDate() instanceof DateTimeValue) {
         $new_task->setStartDate(new DateTimeValue($this->getStartDate()->getTimestamp()));
     }
     if ($copy_status) {
         $new_task->setCompletedById($this->getCompletedById());
         $new_task->setCompletedOn($this->getCompletedOn());
     }
     $new_task->save();
     $new_task->setTagsFromCSV(implode(",", $this->getTagNames()));
     foreach ($this->getWorkspaces() as $ws) {
         $new_task->addToWorkspace($ws);
     }
     if (is_array($this->getAllLinkedObjects())) {
         foreach ($this->getAllLinkedObjects() as $lo) {
             $new_task->linkObject($lo);
         }
     }
     $sub_tasks = $this->getAllSubTasks();
     foreach ($sub_tasks as $st) {
         if ($st->getParentId() == $this->getId()) {
             $new_st = $st->cloneTask($copy_status);
             if ($copy_status) {
                 $new_st->setCompletedById($st->getCompletedById());
                 $new_st->setCompletedOn($st->getCompletedOn());
                 $new_st->save();
             }
             $new_task->attachTask($new_st);
         }
     }
     foreach ($this->getAllComments() as $com) {
         $new_com = new Comment();
         $new_com->setAuthorEmail($com->getAuthorEmail());
         $new_com->setAuthorName($com->getAuthorName());
         $new_com->setAuthorHomepage($com->getAuthorHomepage());
         $new_com->setCreatedById($com->getCreatedById());
         $new_com->setCreatedOn($com->getCreatedOn());
         $new_com->setUpdatedById($com->getUpdatedById());
         $new_com->setUpdatedOn($com->getUpdatedOn());
         $new_com->setIsAnonymous($com->getIsAnonymous());
         $new_com->setIsPrivate($com->getIsPrivate());
         $new_com->setText($com->getText());
         $new_com->setRelObjectId($new_task->getId());
         $new_com->setRelObjectManager("ProjectTasks");
         $new_com->save();
     }
     $_POST['subscribers'] = array();
     foreach ($this->getSubscribers() as $sub) {
         $_POST['subscribers']["user_" . $sub->getId()] = "checked";
     }
     $obj_controller = new ObjectController();
     $obj_controller->add_subscribers($new_task);
     foreach ($this->getCustomProperties() as $prop) {
         $new_prop = new ObjectProperty();
         $new_prop->setRelObjectId($new_task->getId());
         $new_prop->setRelObjectManager($prop->getRelObjectManager());
         $new_prop->setPropertyName($prop->getPropertyName());
         $new_prop->setPropertyValue($prop->getPropertyValue());
         $new_prop->save();
     }
     $custom_props = CustomProperties::getAllCustomPropertiesByObjectType("ProjectTasks");
     foreach ($custom_props as $c_prop) {
         $values = CustomPropertyValues::getCustomPropertyValues($this->getId(), $c_prop->getId());
         if (is_array($values)) {
             foreach ($values as $val) {
                 $cp = new CustomPropertyValue();
                 $cp->setObjectId($new_task->getId());
                 $cp->setCustomPropertyId($val->getCustomPropertyId());
                 $cp->setValue($val->getValue());
                 $cp->save();
             }
         }
     }
     $reminders = ObjectReminders::getByObject($this);
     foreach ($reminders as $reminder) {
         $copy_reminder = new ObjectReminder();
         $copy_reminder->setContext($reminder->getContext());
         $reminder_date = $new_task->getColumnValue($reminder->getContext());
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:ProjectTask.class.php

示例6: lang

	
	<table><tr><th></th><th><?php 
    echo $import_type == 'contact' ? lang('contact fields') : lang('company fields');
    ?>
</th><th><?php 
    echo lang('fields from file');
    ?>
</th></tr>
	
	<?php 
    if ($import_type == 'contact') {
        $contact_fields = Contacts::getContactFieldNames();
    } else {
        $contact_fields = Contacts::getCompanyFieldNames();
    }
    $custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(Contacts::instance()->getObjectTypeId());
    +($isAlt = false);
    $i = 0;
    $label_w = $label_h = $label_o = false;
    foreach ($contact_fields as $c_field => $c_label) {
        if (str_starts_with($c_field, 'contact[w') && !$label_w) {
            ?>
<tr><td colspan="3" style="text-align:center;"><b><?php 
            echo lang('work');
            ?>
</b></td></tr> <?php 
            $label_w = true;
        } else {
            if (str_starts_with($c_field, 'contact[h') && !$label_h) {
                ?>
<tr><td colspan="3" style="text-align:center;"><b><?php 
开发者ID:abhinay100,项目名称:feng_app,代码行数:30,代码来源:csv_import.php

示例7: require_javascript

<?php

require_javascript("og/CustomProperties.js");
$cps = CustomProperties::getAllCustomPropertiesByObjectType($_custom_properties_object->getObjectTypeId(), $co_type);
$ti = 0;
if (!isset($genid)) {
    $genid = gen_id();
}
if (!isset($startTi)) {
    $startTi = 10000;
}
if (count($cps) > 0) {
    $print_table_functions = false;
    foreach ($cps as $customProp) {
        if (!isset($required) || $required && ($customProp->getIsRequired() || $customProp->getVisibleByDefault()) || !$required && !($customProp->getIsRequired() || $customProp->getVisibleByDefault())) {
            $ti++;
            $cpv = CustomPropertyValues::getCustomPropertyValue($_custom_properties_object->getId(), $customProp->getId());
            $default_value = $customProp->getDefaultValue();
            if ($cpv instanceof CustomPropertyValue) {
                $default_value = $cpv->getValue();
            }
            $name = 'object_custom_properties[' . $customProp->getId() . ']';
            echo '<div style="margin-top:6px">';
            if ($customProp->getType() == 'boolean') {
                echo checkbox_field($name, $default_value, array('tabindex' => $startTi + $ti, 'style' => 'margin-right:4px', 'id' => $genid . 'cp' . $customProp->getId()));
            }
            echo label_tag(clean($customProp->getName()), $genid . 'cp' . $customProp->getId(), $customProp->getIsRequired(), array('style' => 'display:inline'), $customProp->getType() == 'boolean' ? '' : ':');
            if ($customProp->getDescription() != '') {
                echo '<span class="desc"> - ' . clean($customProp->getDescription()) . '</span>';
            }
            echo '</div>';
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:object_custom_properties.php

示例8: prepareObject

 /**
  * Prepares return object for a list of emails and messages
  *
  * @param array $totMsg
  * @param integer $start
  * @param integer $limit
  * @return array
  */
 private function prepareObject($totMsg, $start, $limit, $total)
 {
     $object = array("totalCount" => $total, "start" => $start, "messages" => array());
     $custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(ProjectMessages::instance()->getObjectTypeId());
     $ids = array();
     for ($i = 0; $i < $limit; $i++) {
         if (isset($totMsg[$i])) {
             $msg = $totMsg[$i];
             if ($msg instanceof ProjectMessage) {
                 $text = $msg->getText();
                 if (strlen($text) > 100) {
                     $text = substr_utf($text, 0, 100) . "...";
                 }
                 $object["messages"][$i] = array("id" => $i, "ix" => $i, "object_id" => $msg->getId(), "ot_id" => $msg->getObjectTypeId(), "type" => $msg->getObjectTypeName(), "name" => $msg->getObjectName(), "text" => html_to_text($text), "date" => $msg->getUpdatedOn() instanceof DateTimeValue ? $msg->getUpdatedOn()->isToday() ? format_time($msg->getUpdatedOn()) : format_datetime($msg->getUpdatedOn()) : '', "is_today" => $msg->getUpdatedOn() instanceof DateTimeValue ? $msg->getUpdatedOn()->isToday() : 0, "userId" => $msg->getCreatedById(), "userName" => $msg->getCreatedByDisplayName(), "updaterId" => $msg->getUpdatedById() ? $msg->getUpdatedById() : $msg->getCreatedById(), "updaterName" => $msg->getUpdatedById() ? $msg->getUpdatedByDisplayName() : $msg->getCreatedByDisplayName(), "memPath" => json_encode($msg->getMembersIdsToDisplayPath()));
                 $ids[] = $msg->getId();
                 foreach ($custom_properties as $cp) {
                     $object["messages"][$i]['cp_' . $cp->getId()] = get_custom_property_value_for_listing($cp, $msg);
                 }
             }
         }
     }
     $read_objects = ReadObjects::getReadByObjectList($ids, logged_user()->getId());
     foreach ($object["messages"] as &$data) {
         $data['isRead'] = isset($read_objects[$data['object_id']]);
     }
     return $object;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:35,代码来源:MessageController.class.php

示例9: prepareObject

	/**
	 * Prepares return object for a list of emails and messages
	 *
	 * @param array $totMsg
	 * @param integer $start
	 * @param integer $limit
	 * @return array
	 */
	private function prepareObject($emails, $start, $limit, $total, $attributes = null) {
		$object = array(
			"totalCount" => intval($total),
			"start" => $start,//(integer)min(array(count($totMsg) - (count($totMsg) % $limit),$start)),
			"messages" => array()
		);
		$custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(MailContents::instance()->getObjectTypeId());
		$i=0;
		foreach ($emails as $email) {
			if ($email instanceof MailContent) {
				$properties = $this->getMailProperties($email, $i);
				$object["messages"][$i] = $properties;
			}
			foreach ($custom_properties as $cp) {
				$cp_value = CustomPropertyValues::getCustomPropertyValue($email->getId(), $cp->getId());
				$object["messages"][$i]['cp_'.$cp->getId()] = $cp_value instanceof CustomPropertyValue ? $cp_value->getValue() : '';
			}
			$i++;
		}
		return $object;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:29,代码来源:MailController.class.php

示例10: prepareObject

 /**
  * Prepares return object for a list of emails and messages
  *
  * @param array $totMsg
  * @param integer $start
  * @param integer $limit
  * @return array
  */
 private function prepareObject($emails, $start, $limit, $total, $attributes = null)
 {
     $object = array("totalCount" => intval($total), "start" => $start, "messages" => array());
     $custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(MailContents::instance()->getObjectTypeId());
     $i = 0;
     foreach ($emails as $email) {
         if ($email instanceof MailContent) {
             $properties = $this->getMailProperties($email, $i);
             $object["messages"][$i] = $properties;
         }
         foreach ($custom_properties as $cp) {
             $object["messages"][$i]['cp_' . $cp->getId()] = get_custom_property_value_for_listing($cp, $email);
         }
         $i++;
     }
     //set columns to show for this folder
     if (isset($attributes)) {
         $string = user_config_option("folder_" . $attributes["stateType"] . "_columns");
         $columns = explode(",", $string);
         foreach ($columns as $col) {
             $object["folder_columns"][] = $col;
         }
         $object["folder_name"] = $attributes["stateType"];
         //if you want to add a column add their name here too
         $object["folder_columns_all"] = array("from", "to", "subject", "account", "date", "folder", "actions");
     }
     return $object;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:36,代码来源:MailController.class.php

示例11: add_custom_properties

 /**
  * Adds the custom properties of an object into the database.
  * 
  * @param $object
  * @return unknown_type
  */
 function add_custom_properties($object)
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $obj_custom_properties = array_var($_POST, 'object_custom_properties');
     if (is_array($obj_custom_properties)) {
         foreach ($obj_custom_properties as $id => &$val) {
             $val = remove_scripts($val);
         }
     }
     $date_format = user_config_option('date_format');
     $date_format_tip = date_format_tip($date_format);
     $required_custom_props = array();
     $object_type_id = $object instanceof TemplateTask ? ProjectTasks::instance()->getObjectTypeId() : $object->getObjectTypeId();
     $customProps = CustomProperties::getAllCustomPropertiesByObjectType($object_type_id);
     //Sets all boolean custom properties to 0. If any boolean properties are returned, they are subsequently set to 1.
     foreach ($customProps as $cp) {
         if ($cp->getType() == 'boolean') {
             $custom_property_value = CustomPropertyValues::getCustomPropertyValue($object->getId(), $cp->getId());
             if (!$custom_property_value instanceof CustomPropertyValue) {
                 $custom_property_value = new CustomPropertyValue();
             }
             $custom_property_value->setObjectId($object->getId());
             $custom_property_value->setCustomPropertyId($cp->getId());
             $custom_property_value->setValue(0);
             $custom_property_value->save();
         }
         if ($cp->getIsRequired()) {
             $required_custom_props[] = $cp;
         }
     }
     foreach ($required_custom_props as $req_cp) {
         if (!isset($obj_custom_properties[$req_cp->getId()])) {
             throw new Exception(lang('custom property value required', $req_cp->getName()));
         }
     }
     if (is_array($obj_custom_properties)) {
         // check required custom properties
         foreach ($obj_custom_properties as $id => $value) {
             //Get the custom property
             $custom_property = null;
             foreach ($customProps as $cp) {
                 if ($cp->getId() == $id) {
                     $custom_property = $cp;
                     break;
                 }
             }
             if ($custom_property instanceof CustomProperty) {
                 // save dates in standard format "Y-m-d H:i:s", because the column type is string
                 if ($custom_property->getType() == 'date') {
                     if (is_array($value)) {
                         $newValues = array();
                         foreach ($value as $val) {
                             if (trim($val) != '' && trim($val) != $date_format_tip) {
                                 $dtv = DateTimeValueLib::dateFromFormatAndString($date_format, $val);
                                 $newValues[] = $dtv->format("Y-m-d H:i:s");
                             }
                         }
                         $value = $newValues;
                     } else {
                         if (trim($value) != '' && trim($val) != $date_format_tip) {
                             $dtv = DateTimeValueLib::dateFromFormatAndString($date_format, $value);
                             $value = $dtv->format("Y-m-d H:i:s");
                         } else {
                             $value = '';
                         }
                     }
                 }
                 foreach (array_var($_REQUEST, 'remove_custom_properties', array()) as $cpropid => $remove) {
                     if ($remove) {
                         CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $cpropid);
                     }
                 }
                 Hook::fire('before_save_custom_property_value', array('custom_prop' => $custom_property), $value);
                 if (is_array($value)) {
                     if ($custom_property->getType() == 'address') {
                         if ($custom_property->getIsRequired()) {
                             if (array_var($value, 'street') == '' && array_var($value, 'city') == '' && array_var($value, 'state') == '' && array_var($value, 'country') == '' && array_var($value, 'zip_code') == '') {
                                 throw new Exception(lang('custom property value required', $custom_property->getName()));
                             }
                             $errors = array(lang('error form validation'));
                             Env::useHelper('form');
                             $ok = checkAddressInputMandatoryFields($value, $custom_property->getName(), $errors);
                             if (!$ok) {
                                 throw new Exception(implode("\n - ", $errors));
                             }
                         }
                         // Address custom property
                         $val = array_var($value, 'type') . '|' . array_var($value, 'street') . '|' . array_var($value, 'city') . '|' . array_var($value, 'state') . '|' . array_var($value, 'country') . '|' . array_var($value, 'zip_code');
                         CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $id);
                         $custom_property_value = new CustomPropertyValue();
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:ObjectController.class.php

示例12: copy_additional_object_data

/**
 * Copies related data from an object to another (members, linked_objects, custom_properties, subscribers, reminders and comments)
 * @param $object: Original object to copy data
 * @param $copy: Object to be modified with the data of the $orignal object
 * @param $options: set which type of data will not be copied
 */
function copy_additional_object_data($object, &$copy, $options = array())
{
    if (!$object instanceof ContentDataObject || !$copy instanceof ContentDataObject) {
        // if not valid objects return
        return;
    }
    $copy_members = !array_var($options, 'dont_copy_members');
    $copy_linked_objects = !array_var($options, 'dont_copy_linked_objects');
    $copy_custom_properties = !array_var($options, 'dont_copy_custom_properties');
    $copy_subscribers = !array_var($options, 'dont_copy_subscribers');
    $copy_reminders = !array_var($options, 'dont_copy_reminders');
    $copy_comments = !array_var($options, 'dont_copy_comments');
    $controller = new ObjectController();
    // copy members
    if ($copy_members) {
        $object_members = $object->getMembers();
        $copy->addToMembers($object_members);
        Hook::fire('after_add_to_members', $copy, $object_members);
        $copy->addToSharingTable();
    }
    // copy linked objects
    if ($copy_linked_objects) {
        $copy->copyLinkedObjectsFrom($object);
    }
    // copy custom properties
    if ($copy_custom_properties) {
        // custom properties defined in "settings"
        $cp_object_type_id = $object->getObjectTypeId();
        if ($object instanceof TemplateTask || $object instanceof TemplateMilestone) {
            $cp_object_type_id = $copy->getObjectTypeId();
        }
        $custom_props = CustomProperties::getAllCustomPropertiesByObjectType($cp_object_type_id);
        foreach ($custom_props as $c_prop) {
            $values = CustomPropertyValues::getCustomPropertyValues($object->getId(), $c_prop->getId());
            if (is_array($values)) {
                foreach ($values as $val) {
                    $cp = new CustomPropertyValue();
                    $cp->setObjectId($copy->getId());
                    $cp->setCustomPropertyId($val->getCustomPropertyId());
                    $cp->setValue($val->getValue());
                    $cp->save();
                }
            }
        }
        // object properties (key-value)
        $copy->copyCustomPropertiesFrom($object);
    }
    // copy subscribers
    if ($copy_subscribers) {
        $subscribers_array = array();
        foreach ($object->getSubscriberIds() as $user_id) {
            $subscribers_array["user_" . $user_id] = "1";
        }
        $controller->add_subscribers($copy, $subscribers_array);
    }
    // copy reminders
    if ($copy_reminders) {
        $reminders = ObjectReminders::getByObject($object);
        foreach ($reminders as $reminder) {
            $copy_reminder = new ObjectReminder();
            $copy_reminder->setContext($reminder->getContext());
            $reminder_date = $copy->getColumnValue($reminder->getContext());
            if ($reminder_date instanceof DateTimeValue) {
                $reminder_date = new DateTimeValue($reminder_date->getTimestamp());
                $reminder_date->add('m', -$reminder->getMinutesBefore());
            }
            $copy_reminder->setDate($reminder_date);
            $copy_reminder->setMinutesBefore($reminder->getMinutesBefore());
            $copy_reminder->setObject($copy);
            $copy_reminder->setType($reminder->getType());
            $copy_reminder->setUserId($reminder->getUserId());
            $copy_reminder->save();
        }
    }
    // copy comments
    if ($copy_comments) {
        foreach ($object->getAllComments() as $com) {
            $new_com = new Comment();
            $new_com->setAuthorEmail($com->getAuthorEmail());
            $new_com->setAuthorName($com->getAuthorName());
            $new_com->setAuthorHomepage($com->getAuthorHomepage());
            $new_com->setCreatedById($com->getCreatedById());
            $new_com->setCreatedOn($com->getCreatedOn());
            $new_com->setUpdatedById($com->getUpdatedById());
            $new_com->setUpdatedOn($com->getUpdatedOn());
            $new_com->setText($com->getText());
            $new_com->setRelObjectId($copy->getId());
            $new_com->save();
        }
    }
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:97,代码来源:functions.php

示例13: get_class

$cpvCount = CustomPropertyValues::getCustomPropertyValueCount($__properties_object->getId(), get_class($__properties_object->manager()));
if ((!is_array($properties) || count($properties) == 0) && $cpvCount == 0) {
    return "";
}
?>
<div class="commentsTitle"><?php 
echo lang('custom properties');
?>
</div>
<?php 
if ($cpvCount > 0) {
    ?>
<table class="og-custom-properties">
<?php 
    $alt = true;
    $cps = CustomProperties::getAllCustomPropertiesByObjectType(get_class($__properties_object->manager()));
    foreach ($cps as $customProp) {
        $cpv = CustomPropertyValues::getCustomPropertyValue($__properties_object->getId(), $customProp->getId());
        if ($cpv instanceof CustomPropertyValue && ($customProp->getIsRequired() || $cpv->getValue() != '')) {
            $alt = !$alt;
            ?>
			<tr class="<?php 
            echo $alt ? 'altRow' : '';
            ?>
">
				<td class="name" title="<?php 
            echo clean($customProp->getName());
            ?>
"><?php 
            echo clean(truncate($customProp->getName(), 20));
            ?>
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:view.php

示例14: list_files


//.........这里部分代码省略.........
     if ($order == ProjectFiles::ORDER_BY_POSTTIME) {
         $order = '`created_on`';
     } else {
         if ($order == ProjectFiles::ORDER_BY_MODIFYTIME) {
             $order = '`updated_on`';
         } else {
             if ($order == ProjectFiles::ORDER_BY_SIZE) {
                 $order = '`jt`.`filesize`';
                 $join_params = array('table' => ProjectFileRevisions::instance()->getTableName(), 'jt_field' => 'file_id', 'e_field' => 'object_id');
                 $extra_conditions .= " AND `jt`.`object_id` = (SELECT max(`x`.`object_id`) FROM " . TABLE_PREFIX . "project_file_revisions `x` WHERE `x`.`file_id` = `e`.`object_id`)";
             } else {
                 if ($order == 'customProp') {
                     $order = 'IF(ISNULL(jt.value),1,0),jt.value';
                     $join_params['join_type'] = "LEFT ";
                     $join_params['table'] = "" . TABLE_PREFIX . "custom_property_values";
                     $join_params['jt_field'] = "object_id";
                     $join_params['e_field'] = "object_id";
                     $join_params['on_extra'] = "AND custom_property_id = " . $cpId;
                     $extra_conditions .= " AND ( custom_property_id = " . $cpId . " OR custom_property_id IS NULL)";
                     $select_columns = array("DISTINCT o.*", "e.*");
                 } else {
                     $order = '`name`';
                 }
             }
         }
     }
     // if
     $extra_conditions .= $hide_private ? 'AND `is_visible` = 1' : '';
     // filter attachments of other people if not filtering
     $tmp_mids = array();
     foreach (active_context() as $selection) {
         if ($selection instanceof Member) {
             $d = $selection->getDimension();
             if ($d instanceof Dimension && $d->getIsManageable()) {
                 $tmp_mids[] = $selection->getId();
             }
         }
     }
     if (count($tmp_mids) == 0) {
         if (Plugins::instance()->isActivePlugin('mail')) {
             $extra_conditions .= " AND IF(e.mail_id=0, true, EXISTS (SELECT mac.contact_id FROM " . TABLE_PREFIX . "mail_account_contacts mac \r\n\t\t\t\t\tWHERE mac.contact_id=o.created_by_id AND mac.account_id=(SELECT mc.account_id FROM " . TABLE_PREFIX . "mail_contents mc WHERE mc.object_id=e.mail_id)))";
         }
     }
     Hook::fire("listing_extra_conditions", null, $extra_conditions);
     $only_count_result = array_var($_GET, 'only_result', false);
     $context = active_context();
     $objects = ProjectFiles::instance()->listing(array("order" => $order, "order_dir" => $order_dir, "extra_conditions" => $extra_conditions, "show_only_member_objects" => user_config_option('show_only_member_files'), 'count_results' => false, 'only_count_results' => $only_count_result, "join_params" => $join_params, "start" => $start, "limit" => $limit, "select_columns" => $select_columns));
     $custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(ProjectFiles::instance()->getObjectTypeId());
     // prepare response object
     $listing = array("totalCount" => $objects->total, "start" => $start, "objType" => ProjectFiles::instance()->getObjectTypeId(), "files" => array());
     if (is_array($objects->objects)) {
         $index = 0;
         $ids = array();
         foreach ($objects->objects as $o) {
             $coName = "";
             $coId = $o->getCheckedOutById();
             if ($coId != 0) {
                 if ($coId == logged_user()->getId()) {
                     $coName = "self";
                 } else {
                     $coUser = Contacts::findById($coId);
                     if ($coUser instanceof Contact) {
                         $coName = $coUser->getObjectName();
                     } else {
                         $coName = "";
                     }
                 }
             }
             if ($o->isMP3()) {
                 $songname = $o->getProperty("songname");
                 $artist = $o->getProperty("songartist");
                 $album = $o->getProperty("songalbum");
                 $track = $o->getProperty("songtrack");
                 $year = $o->getProperty("songyear");
                 $duration = $o->getProperty("songduration");
                 $songInfo = json_encode(array($songname, $artist, $album, $track, $year, $duration, $o->getDownloadUrl(), $o->getFilename(), $o->getId()));
             } else {
                 $songInfo = array();
             }
             $ids[] = $o->getId();
             $values = array("id" => $o->getId(), "ix" => $index++, "object_id" => $o->getId(), "ot_id" => $o->getObjectTypeId(), "name" => $o->getObjectName(), "type" => $o->getTypeString(), "mimeType" => $o->getTypeString(), "createdBy" => clean($o->getCreatedByDisplayName()), "createdById" => $o->getCreatedById(), "dateCreated" => $o->getCreatedOn() instanceof DateTimeValue ? $o->getCreatedOn()->isToday() ? format_time($o->getCreatedOn()) : format_datetime($o->getCreatedOn()) : '', "dateCreated_today" => $o->getCreatedOn() instanceof DateTimeValue ? $o->getCreatedOn()->isToday() : 0, "updatedBy" => clean($o->getUpdatedByDisplayName()), "updatedById" => $o->getUpdatedById(), "dateUpdated" => $o->getUpdatedOn() instanceof DateTimeValue ? $o->getUpdatedOn()->isToday() ? format_time($o->getUpdatedOn()) : format_datetime($o->getUpdatedOn()) : '', "dateUpdated_today" => $o->getUpdatedOn() instanceof DateTimeValue ? $o->getUpdatedOn()->isToday() : 0, "icon" => $o->getTypeIconUrl(), "size" => format_filesize($o->getFileSize()), "url" => $o->getOpenUrl(), "manager" => get_class($o->manager()), "checkedOutByName" => $coName, "checkedOutById" => $coId, "isModifiable" => $o->isModifiable() && $o->canEdit(logged_user()), "modifyUrl" => $o->getModifyUrl(), "songInfo" => $songInfo, "ftype" => $o->getType(), "url" => $o->getUrl(), "memPath" => json_encode($o->getMembersIdsToDisplayPath()), "genid" => gen_id());
             if ($o->isMP3()) {
                 $values['isMP3'] = true;
             }
             Hook::fire('add_classification_value', $o, $values);
             foreach ($custom_properties as $cp) {
                 $values['cp_' . $cp->getId()] = get_custom_property_value_for_listing($cp, $o);
             }
             $listing["files"][] = $values;
         }
         $read_objects = ReadObjects::getReadByObjectList($ids, logged_user()->getId());
         foreach ($listing["files"] as &$data) {
             $data['isRead'] = isset($read_objects[$data['object_id']]);
         }
         ajx_extra_data($listing);
         tpl_assign("listing", $listing);
     } else {
         throw new Error("Not array", $code);
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:FilesController.class.php

示例15: lang

$cpvCount = CustomPropertyValues::getCustomPropertyValueCount($__properties_object);
if ((!is_array($properties) || count($properties) == 0) && $cpvCount == 0) {
    return "";
}
?>
<div class="commentsTitle"><?php 
echo lang('custom properties');
?>
</div>
<?php 
if ($cpvCount > 0) {
    ?>
<table class="og-custom-properties">
<?php 
    $alt = true;
    $cps = CustomProperties::getAllCustomPropertiesByObjectType($__properties_object->getObjectTypeId());
    foreach ($cps as $customProp) {
        $cpv = CustomPropertyValues::getCustomPropertyValue($__properties_object->getId(), $customProp->getId());
        if ($cpv instanceof CustomPropertyValue && ($customProp->getIsRequired() || $cpv->getValue() != '')) {
            $alt = !$alt;
            ?>
			<tr class="<?php 
            echo $alt ? 'altRow' : '';
            ?>
">
				<td class="name" title="<?php 
            echo clean($customProp->getName());
            ?>
"><?php 
            echo clean($customProp->getName());
            ?>
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:view.php


注:本文中的CustomProperties::getAllCustomPropertiesByObjectType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。