本文整理汇总了PHP中CustomProperties类的典型用法代码示例。如果您正苦于以下问题:PHP CustomProperties类的具体用法?PHP CustomProperties怎么用?PHP CustomProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: getReportColumnNames
/**
* Return all report column names
*
* @param report_id
* @return array
*/
static function getReportColumnNames($report_id)
{
$colNames = array();
$columns = self::findAll(array('conditions' => array("`report_id` = ?", $report_id)));
// findAll
foreach ($columns as $col) {
if ($col->getCustomPropertyId() > 0) {
$cp = CustomProperties::getCustomProperty($col->getCustomPropertyId());
if ($cp instanceof CustomProperty) {
$colNames[] = $cp->getName();
}
} else {
$colNames[] = $col->getFieldName();
}
}
return $colNames;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:23,代码来源:ReportColumns.class.php
示例3: validate
/**
* Validate before save
*
* @access public
* @param array $errors
* @return null
*/
function validate(&$errors) {
$cp = CustomProperties::getCustomProperty($this->getCustomPropertyId());
if($cp instanceof CustomProperty){
if($cp->getIsRequired() && ($this->getValue() == '')){
$errors[] = lang('custom property value required', $cp->getName());
}
if($cp->getType() == 'numeric'){
if($cp->getIsMultipleValues()){
foreach(explode(',', $this->getValue()) as $value){
if($value != '' && !is_numeric($value)){
$errors[] = lang('value must be numeric', $cp->getName());
}
}
}else{
if($this->getValue() != '' && !is_numeric($this->getValue())){
$errors[] = lang('value must be numeric', $cp->getName());
}
}
}
}//if
} // validate
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:28,代码来源:CustomPropertyValue.class.php
示例4: require_javascript
<div class="custom-properties"><?php
require_javascript("og/CustomProperties.js");
$object_type_id = $_custom_properties_object instanceof TemplateTask ? ProjectTasks::instance()->getObjectTypeId() : $_custom_properties_object->getObjectTypeId();
$cps = CustomProperties::getAllCustomPropertiesByObjectType($object_type_id, $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:12px">';
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' ? '' : ':');
echo '</div>';
switch ($customProp->getType()) {
case 'text':
case 'numeric':
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:object_custom_properties.php
示例5: 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');
$customProps = CustomProperties::getAllCustomPropertiesByObjectType($object->getObjectTypeId());
//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 (is_array($obj_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) {
$dtv = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $val);
$newValues[] = $dtv->format("Y-m-d H:i:s");
}
$value = $newValues;
} else {
$dtv = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $value);
$value = $dtv->format("Y-m-d H:i:s");
}
}
//Save multiple values
if (is_array($value)) {
CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $id);
foreach ($value as &$val) {
if (is_array($val)) {
// CP type == table
$str_val = '';
foreach ($val as $col_val) {
$col_val = str_replace("|", "\\|", $col_val);
$str_val .= ($str_val == '' ? '' : '|') . $col_val;
}
$val = $str_val;
}
if ($val != '') {
if (strpos($val, ',')) {
$val = str_replace(',', '|', $val);
}
$custom_property_value = new CustomPropertyValue();
$custom_property_value->setObjectId($object->getId());
$custom_property_value->setCustomPropertyId($id);
$custom_property_value->setValue($val);
$custom_property_value->save();
}
}
} else {
if ($custom_property->getType() == 'boolean') {
$value = isset($value);
}
$cpv = CustomPropertyValues::getCustomPropertyValue($object->getId(), $id);
if ($cpv instanceof CustomPropertyValue) {
$custom_property_value = $cpv;
} else {
$custom_property_value = new CustomPropertyValue();
}
$custom_property_value->setObjectId($object->getId());
$custom_property_value->setCustomPropertyId($id);
$custom_property_value->setValue($value);
$custom_property_value->save();
}
//Add to searchable objects
if ($object->isSearchable() && ($custom_property->getType() == 'text' || $custom_property->getType() == 'list' || $custom_property->getType() == 'numeric')) {
$name = $custom_property->getName();
$searchable_object = SearchableObjects::findOne(array("conditions" => "`rel_object_id` = " . $object->getId() . " AND `column_name` = '{$name}'"));
if (!$searchable_object) {
$searchable_object = new SearchableObject();
}
if (is_array($value)) {
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ObjectController.class.php
示例6: 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($objects, $count, $start = 0, $attributes = null)
{
$object = array(
"totalCount" => $count,
"start" => $start,
"contacts" => array()
);
$custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(Contacts::instance()->getObjectTypeId());
for ($i = 0; $i < count($objects); $i++){
if (isset($objects[$i])){
$c= $objects[$i];
if ($c instanceof Contact && !$c->isCompany()){
$company = $c->getCompany();
$companyName = '';
if (!is_null($company))
$companyName= $company->getObjectName();
$personal_emails = $c->getContactEmails('personal');
$w_address = $c->getAddress('work');
$h_address = $c->getAddress('home');
$object["contacts"][$i] = array(
"id" => $i,
"ix" => $i,
"object_id" => $c->getId(),
"ot_id" => $c->getObjectTypeId(),
"type" => 'contact',
"name" => $c->getReverseDisplayName(),
"email" => $c->getEmailAddress('personal',true),
"companyId" => $c->getCompanyId(),
"companyName" => $companyName,
"website" => $c->getWebpage('personal') ? cleanUrl($c->getWebpageUrl('personal'), false) : '',
"jobTitle" => $c->getJobTitle(),
"department" => $c->getDepartment(),
"email2" => !is_null($personal_emails) && isset($personal_emails[0]) ? $personal_emails[0]->getEmailAddress() : '',
"email3" => !is_null($personal_emails) && isset($personal_emails[1]) ? $personal_emails[1]->getEmailAddress() : '',
"workWebsite" => $c->getWebpage('work') ? cleanUrl($c->getWebpageUrl('work'), false) : '',
"workAddress" => $w_address ? $c->getFullAddress($w_address) : '',
"workPhone1" => $c->getPhone('work',true) ? $c->getPhoneNumber('work',true) : '',
"workPhone2" => $c->getPhone('work') ? $c->getPhoneNumber('work') : '',
"homeWebsite" => $c->getWebpage('personal') ? cleanUrl($c->getWebpageUrl('personal'), false) : '',
"homeAddress" => $h_address ? $c->getFullAddress($h_address) : '',
"homePhone1" => $c->getPhone('home',true) ? $c->getPhoneNumber('home',true) : '',
"homePhone2" => $c->getPhone('home') ? $c->getPhoneNumber('home') : '',
"mobilePhone" =>$c->getPhone('mobile') ? $c->getPhoneNumber('mobile') : '',
"createdOn" => $c->getCreatedOn() instanceof DateTimeValue ? ($c->getCreatedOn()->isToday() ? format_time($c->getCreatedOn()) : format_datetime($c->getCreatedOn())) : '',
"createdOn_today" => $c->getCreatedOn() instanceof DateTimeValue ? $c->getCreatedOn()->isToday() : 0,
"createdBy" => $c->getCreatedByDisplayName(),
"createdById" => $c->getCreatedById(),
"updatedOn" => $c->getUpdatedOn() instanceof DateTimeValue ? ($c->getUpdatedOn()->isToday() ? format_time($c->getUpdatedOn()) : format_datetime($c->getUpdatedOn())) : '',
"updatedOn_today" => $c->getUpdatedOn() instanceof DateTimeValue ? $c->getUpdatedOn()->isToday() : 0,
"updatedBy" => $c->getUpdatedByDisplayName(),
"updatedById" => $c->getUpdatedById(),
"memPath" => json_encode($c->getMembersToDisplayPath()),
"userType" => $c->getUserType(),
);
} else if ($c instanceof Contact){
$w_address = $c->getAddress('work');
$object["contacts"][$i] = array(
"id" => $i,
"ix" => $i,
"object_id" => $c->getId(),
"ot_id" => $c->getObjectTypeId(),
"type" => 'company',
'name' => $c->getObjectName(),
'email' => $c->getEmailAddress(),
'website' => $c->getWebpage('work') ? cleanUrl($c->getWebpageUrl('work'), false) : '',
'workPhone1' => $c->getPhone('work',true) ? $c->getPhoneNumber('work',true) : '',
'workPhone2' => $c->getPhone('fax',true) ? $c->getPhoneNumber('fax',true) : '',
'workAddress' => $w_address ? $c->getFullAddress($w_address) : '',
"companyId" => $c->getId(),
"companyName" => $c->getObjectName(),
"jobTitle" => '',
"department" => lang('company'),
"email2" => '',
"email3" => '',
"workWebsite" => $c->getWebpage('work') ? cleanUrl($c->getWebpageUrl('work'), false) : '',
"homeWebsite" => '',
"homeAddress" => '',
"homePhone1" => '',
"homePhone2" => '',
"mobilePhone" =>'',
"createdOn" => $c->getCreatedOn() instanceof DateTimeValue ? ($c->getCreatedOn()->isToday() ? format_time($c->getCreatedOn()) : format_datetime($c->getCreatedOn())) : '',
"createdOn_today" => $c->getCreatedOn() instanceof DateTimeValue ? $c->getCreatedOn()->isToday() : 0,
"createdBy" => $c->getCreatedByDisplayName(),
"createdById" => $c->getCreatedById(),
"updatedOn" => $c->getUpdatedOn() instanceof DateTimeValue ? ($c->getUpdatedOn()->isToday() ? format_time($c->getUpdatedOn()) : format_datetime($c->getUpdatedOn())) : '',
"updatedOn_today" => $c->getUpdatedOn() instanceof DateTimeValue ? $c->getUpdatedOn()->isToday() : 0,
"updatedBy" => $c->getUpdatedByDisplayName(),
"updatedById" => $c->getUpdatedById(),
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:ContactController.class.php
示例7: label_tag
<div>
<?php
echo label_tag(lang('display name'), 'profileFormDisplayName');
?>
<?php
echo text_field('user[display_name]', array_var($user_data, 'display_name'), array('id' => 'profileFormDisplayName', 'tabindex' => '1000', 'class' => 'title'));
?>
</div>
<?php
$categories = array();
Hook::fire('object_edit_categories', $object, $categories);
?>
<?php
$cps = CustomProperties::countHiddenCustomPropertiesByObjectType('Users');
?>
<div style="padding-top:5px">
<?php
if (logged_user()->isAdministrator()) {
?>
<a href="#" class="option" tabindex=1010 onclick="og.toggleAndBolden('<?php
echo $genid;
?>
update_profile_administrator_options',this)"><?php
echo lang('administrator options');
?>
</a> -
<?php
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:30,代码来源:edit_profile.php
示例8: label_tag
</script>
<!-- user type -->
<div>
<?php
echo label_tag(lang('user type'), null, true);
$permission_groups=array();
foreach($groups as $group){
$permission_groups[] = array($group->getId(), lang($group->getName()));
}
echo simple_select_box('user[type]', $permission_groups, null, array('onchange' => "og.addUserTypeChange('$genid', this.value)", 'tabindex' => "300"));
?>
</div>
<?php $categories = array(); Hook::fire('object_add_categories', $object, $categories); ?>
<?php $cps = CustomProperties::countHiddenCustomPropertiesByObjectType(Contacts::getObjectTypeId()); ?>
<div style="padding-top:5px">
<a href="#" class="option" onclick="og.toggleAndBolden('<?php echo $genid ?>add_user_advanced', this)"><?php echo lang('advanced') ?></a> -
<a href="#" class="option" onclick="og.toggleAndBolden('<?php echo $genid ?>add_user_permissions', this)"><?php echo lang('permissions') ?></a>
<?php if ($cps > 0) { ?>
- <a href="#" class="option <?php echo $visible_cps>0 ? 'bold' : ''?>" onclick="og.toggleAndBolden('<?php echo $genid ?>add_custom_properties_div',this)"><?php echo lang('custom properties') ?></a>
<?php } ?>
<?php foreach ($categories as $category) { ?>
- <a href="#" class="option" onclick="og.toggleAndBolden('<?php echo $genid . $category['name'] ?>', this)"><?php echo lang($category['name'])?></a>
<?php } ?>
</div>
</div>
<div class="adminSeparator"></div>
<div class="adminMainBlock">
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:add_user.php
示例9: require_javascript
<?php
require_javascript('og/modules/addMessageForm.js');
$genid = gen_id();
$object = $company;
if ($company->isNew()) {
$form_action = get_url('contact', 'add_company');
} else {
$form_action = $company->getEditUrl();
}
$renderContext = has_context_to_render($company->manager()->getObjectTypeId());
$visible_cps = CustomProperties::countVisibleCustomPropertiesByObjectType($object->getObjectTypeId());
?>
<form onsubmit="return og.handleMemberChooserSubmit('<?php
echo $genid;
?>
', <?php
echo $company->manager()->getObjectTypeId();
?>
);"style="height:100%;background-color:white" class="internalForm" action="<?php
echo $form_action;
?>
" method="post">
<div class="adminAddCompany">
<div class="adminHeader">
<div class="adminHeaderUpperRow">
<div class="adminTitle"><table style="width:535px"><tr><td>
<?php
echo $company->isNew() ? lang('new company') : lang('edit company');
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:add_company.php
示例10: format_value_to_print_task
//for normal properties
//currently disabled as at the moment the only columns that can be added are custom properties
$value = format_value_to_print_task($task->getColumnValue($i), $task->getColumnType($i));
?>
<td style="padding:4px;max-width:250px;<?php
echo $isAlt ? 'background-color:#F2F2F2' : '';
?>
"><?php
echo $value;
?>
</td><?php
} else {
//for custom properties
$values = CustomPropertyValues::getCustomPropertyValue($task->getId(), $i);
if ($values != null) {
$cp = CustomProperties::getCustomProperty($i);
$value = format_value_to_print_task($values->getValue(), $cp->getOgType());
?>
<td style="padding:4px;max-width:250px;<?php
echo $isAlt ? 'background-color:#F2F2F2' : '';
?>
"><?php
echo $value;
?>
</td><?php
} else {
?>
<td style="padding:4px;max-width:250px;<?php
echo $isAlt ? 'background-color:#F2F2F2' : '';
?>
"><?php
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:total_task_times.php
示例11: get_report_column_types
private function get_report_column_types($report_id)
{
$col_types = array();
$report = Reports::getReport($report_id);
$model = $report->getObjectType();
$manager = new $model();
$columns = ReportColumns::getAllReportColumns($report_id);
foreach ($columns as $col) {
$cp_id = $col->getCustomPropertyId();
if ($cp_id == 0) {
$col_types[$col->getFieldName()] = $manager->getColumnType($col->getFieldName());
} else {
$cp = CustomProperties::getCustomProperty($cp_id);
if ($cp) {
$col_types[$cp->getName()] = $cp->getOgType();
}
}
}
return $col_types;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:20,代码来源:ReportingController.class.php
示例12: 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
示例13: 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
示例14: require_javascript
<?php
require_javascript("og/CustomProperties.js");
$cps = CustomProperties::getAllCustomPropertiesByObjectType($type, $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->getName()));
}
echo label_tag(clean($customProp->getName()), $genid . 'cp' . $customProp->getName(), $customProp->getIsRequired(), array('style' => 'display:inline'), $customProp->getType() == 'boolean' ? '' : ':');
if ($customProp->getDescription() != '') {
echo '<span class="desc" style="margin-left:10px">- ' . clean($customProp->getDescription()) . '</span>';
}
echo '</div>';
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:object_custom_properties.php
示例15: paginate
/**
* This function will return paginated result. Result is an array where first element is
* array of returned object and second populated pagination object that can be used for
* obtaining and rendering pagination data using various helpers.
*
* Items and pagination array vars are indexed with 0 for items and 1 for pagination
* because you can't use associative indexing with list() construct
*
* @access public
* @param array $arguments Query argumens (@see find()) Limit and offset are ignored!
* @param integer $items_per_page Number of items per page
* @param integer $current_page Current page number
* @return array
*/
function paginate($arguments = null, $items_per_page = 10, $current_page = 1) {
if(isset($this) && instance_of($this, 'CustomProperties')) {
return parent::paginate($arguments, $items_per_page, $current_page);
} else {
return CustomProperties::instance()->paginate($arguments, $items_per_page, $current_page);
} // if
} // paginate
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:21,代码来源:BaseCustomProperties.class.php
示例16: 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);
}
}
usort($fields, array(&$this, 'compare_FieldName'));
return $fields;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:56,代码来源:SearchController.class.php
示例17: custom_properties
/**
* List custom properties
*
* @access public
* @param void
* @return null
*/
function custom_properties()
{
if (!can_manage_configuration(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$object_types = ObjectTypes::instance()->findAll(array("conditions" => "`type` IN ('content_object') AND `name` <> 'template_task' AND name <> 'template_milestone' AND `name` <> 'file revision'", "order" => "name"));
$ordered_object_types = array();
foreach ($object_types as $ot) {
$ordered_object_types[$ot->getId()] = lang($ot->getName());
}
asort($ordered_object_types, SORT_STRING);
$select_options = array('<option value="" selected>' . lang('select one') . '</option>');
foreach ($ordered_object_types as $k => $v) {
$select_options[] = '<option value="' . $k . '">' . $v . '</option>';
}
tpl_assign('object_types', $select_options);
$custom_properties = array_var($_POST, 'custom_properties');
$obj_type_id = array_var($_POST, 'objectType');
$delete = 0;
if (is_array($custom_properties)) {
try {
DB::beginWork();
foreach ($custom_properties as $id => $data) {
$new_cp = null;
if ($data['id'] != '') {
$new_cp = CustomProperties::getCustomProperty($data['id']);
}
if ($new_cp == null) {
$new_cp = new CustomProperty();
}
if ($data['deleted'] == "1") {
$delete = $delete + 1;
if (!$new_cp->isNew()) {
$new_cp->delete();
}
continue;
}
$new_cp->setObjectTypeId($obj_type_id);
$new_cp->setName($data['name']);
$new_cp->setType($data['type']);
$new_cp->setDescription($data['description']);
if ($data['type'] == 'list') {
$values = array();
$list = explode(",", $data['values']);
foreach ($list as $l) {
$values[] = trim($l);
}
$value = implode(",", $values);
$new_cp->setValues($value);
} else {
$new_cp->setValues($data['values']);
}
if ($data['type'] == 'boolean') {
$new_cp->setDefaultValue(isset($data['default_value_boolean']));
} else {
$new_cp->setDefaultValue($data['default_value']);
}
$new_cp->setIsRequired(isset($data['required']));
$new_cp->setIsMultipleValues(isset($data['multiple_values']));
$new_cp->setOrder($data['order'] - $delete);
$new_cp->setVisibleByDefault(isset($data['visible_by_default']));
$new_cp->save();
if (is_array(array_var($data, 'applyto'))) {
$applyto = array_var($data, 'applyto');
foreach ($applyto as $co_type => $value) {
if ($value == 'true') {
if (!CustomPropertiesByCoType::findById(array('co_type_id' => $co_type, 'cp_id' => $new_cp->getId()))) {
$obj = new CustomPropertyByCoType();
$obj->setCoTypeId($co_type);
$obj->setCpId($new_cp->getId());
$obj->save();
}
} else {
$obj = CustomPropertiesByCoType::findById(array('co_type_id' => $co_type, 'cp_id' => $new_cp->getId()));
|
请发表评论