• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP evt_add函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中evt_add函数的典型用法代码示例。如果您正苦于以下问题:PHP evt_add函数的具体用法?PHP evt_add怎么用?PHP evt_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: edit


//.........这里部分代码省略.........
     tpl_assign('event_data', $event_data);
     tpl_assign('event', $event);
     if (is_array(array_var($_POST, 'event'))) {
         // MANAGE CONCURRENCE WHILE EDITING
         /*
          * FIXME or REMOVEME $upd = array_var($_POST, 'updatedon'); if ($upd && $event->getUpdatedOn()->getTimestamp() > $upd && !array_var($_POST,'merge-changes') == 'true') { ajx_current('empty'); evt_add("handle edit concurrence", array( "updatedon" => $event->getUpdatedOn()->getTimestamp(), "genid" => array_var($_POST,'genid') )); return; } if (array_var($_POST,'merge-changes') == 'true') { $this->setTemplate('view_event'); $editedEvent = ProjectEvents::findById($event->getId()); $this->view(); ajx_set_panel(lang ('tab name',array('name'=>$editedEvent->getTitle()))); ajx_extra_data(array("title" => $editedEvent->getTitle(), 'icon'=>'ico-event')); ajx_set_no_toolbar(true); ajx_set_panel(lang ('tab name',array('name'=>$editedEvent->getTitle()))); return; }
          */
         try {
             $data = $this->getData($event_data);
             // run the query to set the event data
             $event->setFromAttributes($data);
             $this->registerInvitations($data, $event, false);
             if (isset($data['confirmAttendance'])) {
                 $this->change_invitation_state($data['confirmAttendance'], $event->getId(), $user_filter);
             }
             DB::beginWork();
             $event->save();
             $member_ids = json_decode(array_var($_POST, 'members'));
             $object_controller = new ObjectController();
             $object_controller->add_to_members($event, $member_ids);
             $object_controller->add_subscribers($event);
             $object_controller->link_to_new_object($event);
             $object_controller->add_custom_properties($event);
             $old_reminders = ObjectReminders::getByObject($event);
             if ($old_reminders != null) {
                 $object_controller->add_reminders($event);
                 // adding the new reminders, if any
                 $object_controller->update_reminders($event, $old_reminders);
                 // updating the old ones
             } else {
                 if (user_config_option("add_event_autoreminder")) {
                     $reminder = new ObjectReminder();
                     $def = explode(",", user_config_option("reminders_events"));
                     $minutes = $def[2] * $def[1];
                     $reminder->setMinutesBefore($minutes);
                     $reminder->setType($def[0]);
                     $reminder->setContext("start");
                     $reminder->setObject($event);
                     $reminder->setUserId(0);
                     $date = $event->getStart();
                     if ($date instanceof DateTimeValue) {
                         $rdate = new DateTimeValue($date->getTimestamp() - $minutes * 60);
                         $reminder->setDate($rdate);
                     }
                     $reminder->save();
                 }
             }
             $event->resetIsRead();
             DB::commit();
             if ($event->getSpecialID() != "") {
                 $externalCalendarController = new ExternalCalendarController();
                 $externalCalendarController->sync_event_on_extern_calendar($event);
             }
             $is_silent = false;
             if (isset($data['send_notification']) && $data['send_notification']) {
                 $users_to_inv = array();
                 foreach ($data['users_to_invite'] as $us => $v) {
                     if ($us != logged_user()->getId()) {
                         $users_to_inv[] = Contacts::findById(array('id' => $us));
                     }
                 }
                 Notifier::notifEvent($event, $users_to_inv, 'modified', logged_user());
                 $is_silent = true;
             }
             ApplicationLogs::createLog($event, ApplicationLogs::ACTION_EDIT, false, $is_silent);
             $opt_rep_day = array();
             if (array_var($event_data, 'repeat_saturdays')) {
                 $opt_rep_day['saturday'] = true;
             } else {
                 $opt_rep_day['saturday'] = false;
             }
             if (array_var($event_data, 'repeat_sundays')) {
                 $opt_rep_day['sunday'] = true;
             } else {
                 $opt_rep_day['sunday'] = false;
             }
             // $this->repetitive_event($event, $opt_rep_day);
             if ($_POST['type_related'] == "all" || $_POST['type_related'] == "news") {
                 $data['members'] = json_decode(array_var($_POST, 'members'));
                 $this->repetitive_event_related($event, "edit", $_POST['type_related'], $data);
             }
             flash_success(lang('success edit event', clean($event->getObjectName())));
             if (array_var($_POST, 'popup', false)) {
                 ajx_current("reload");
             } else {
                 ajx_current("back");
             }
             ajx_add("overview-panel", "reload");
             if (array_var($_REQUEST, 'modal')) {
                 evt_add("reload current panel");
             }
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
         }
         // try
     }
     // if
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:EventController.class.php


示例2: move

 function move()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     ajx_current("empty");
     $id = get_id();
     $to = array_var($_GET, 'to', 0);
     // TODO: check permissions
     $ws = Projects::findById($id);
     $parent = Projects::findById($to);
     if (isset($ws)) {
         if ($to == 0 || isset($parent)) {
             $ws->setParentId($to);
             $ws->save();
             evt_add('workspace_edited', array("is" => $ws->getId(), "name" => $ws->getId(), "color" => $ws->getId(), "parent" => $ws->getParentId()));
         }
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:21,代码来源:ProjectController.class.php


示例3: quick_config_filter_activity

	function quick_config_filter_activity(){
		$this->setLayout('empty');
		$submited_values = array_var($_POST, 'filter');
		$members = array_var($_GET, 'members');
		tpl_assign('members', array_var($_GET, 'members'));

		$member_name = lang('view');
		$obj_member = Members::findById($members);
		if($obj_member){
			$type_obj = ObjectTypes::findById($obj_member->getObjectTypeId());
			if($obj_member){
				$member_name = lang($type_obj->getName());
			}
		}
		tpl_assign('dim_name', $member_name);

		$filters_default = ContactConfigOptions::getFilterActivity();
		$filters = ContactConfigOptionValues::getFilterActivityMember($filters_default->getId(),$members);

		if(!$filters){
			$filters = ContactConfigOptions::getFilterActivity();
			$filter_value = $filters->getDefaultValue();
			tpl_assign('id', $filters->getId());
		}else{
			$filter_value = $filters->getValue();
			tpl_assign('id', '');
		}
		$filters_def = explode(",",$filter_value);
		//            if($filters_def[0] == 1){
		//                tpl_assign('checked_dimension_yes', 'checked="checked"');
		//            }else{
		//                tpl_assign('checked_dimension_no', 'checked="checked"');
		//            }
		if($filters_def[1] == 1){
			tpl_assign('timeslot', 'checked="checked"');
		}else{
			tpl_assign('timeslot', '');
		}
		tpl_assign('show', $filters_def[2]);
		//            if($filters_def[3] == 1){
		//                tpl_assign('checked_view_downloads_yes', 'checked="checked"');
		//            }else{
		//                tpl_assign('checked_view_downloads_no', 'checked="checked"');
		//            }
		if(is_array($submited_values)) {
			$members = array_var($submited_values,"members");
			$new_value = array_var($submited_values,"dimension",0) . "," . array_var($submited_values,"timeslot",0) . "," . array_var($submited_values,"show",10). "," . array_var($submited_values,"view_downloads",0);
			$filters_default = ContactConfigOptions::getFilterActivity();
			if(array_var($submited_values,"apply_everywhere") == 1){
				$filters_default->setDefaultValue($new_value);
				$filters_default->save();

				$filters = ContactConfigOptionValues::getFilterActivityDelete($filters_default->getId());
			}else{
				$filters = ContactConfigOptionValues::getFilterActivityMember($filters_default->getId(),$members);
				// update cache if available
				if (GlobalCache::isAvailable()) {
					GlobalCache::delete('user_config_option_'.logged_user()->getId().'_'.$filters_default->getName()."_".$members);
				}

				if(!$filters){
					$filter_opt = new ContactConfigOptionValue();
					$filter_opt->setOptionId($filters_default->getId());
					$filter_opt->setContactId(logged_user()->getId());
					$filter_opt->setValue($new_value);
					$filter_opt->setMemberId($members);
					$filter_opt->save();
				}else{
					$filters->setValue($new_value);
					$filters->save();
				}
				evt_add("user preference changed", array('name' => $filters_default->getName()."_".$members, 'value' => $new_value));
			}
			ajx_current("reload");
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:76,代码来源:ContactController.class.php


示例4: dimension_options_submit

 function dimension_options_submit()
 {
     ajx_current("empty");
     if (!can_manage_dimensions(logged_user())) {
         flash_error(lang('no access permissions'));
         return;
     }
     $folder_ots = ObjectTypes::findAll(array('id' => true, 'conditions' => "name IN ('folder','project_folder','customer_folder')"));
     $data = array_var($_POST, 'enabled_dots');
     $names_data = array_var($_POST, 'custom_names');
     if (is_array($data) || is_array($names_data)) {
         try {
             DB::beginWork();
             // enabled dimension object types
             foreach ($data as $dim_id => $ots_info) {
                 foreach ($ots_info as $ot_id => $enabled) {
                     DB::execute("UPDATE " . TABLE_PREFIX . "dimension_object_types SET enabled=" . DB::escape($enabled) . " \r\n\t\t\t\t\t\t\tWHERE dimension_id=" . DB::escape($dim_id) . " AND object_type_id=" . DB::escape($ot_id));
                     // if object type is folder, set the same configuration to all folder types
                     if (in_array($ot_id, $folder_ots)) {
                         DB::execute("UPDATE " . TABLE_PREFIX . "dimension_object_types SET enabled=" . DB::escape($enabled) . "\r\n\t\t\t\t\t\t\t\tWHERE dimension_id=" . DB::escape($dim_id) . " AND object_type_id IN (" . implode(',', $folder_ots) . ")");
                     }
                 }
             }
             // custom dimension names
             foreach ($names_data as $dim_id => $custom_name) {
                 $cname = trim($custom_name);
                 $dimension = Dimensions::getDimensionById($dim_id);
                 if ($dimension instanceof Dimension) {
                     $dimension->setOptionValue('custom_dimension_name', $cname);
                 }
             }
             DB::commit();
             flash_success(lang("success edit dimension options"));
             evt_add('tabs changed');
             //ajx_current("back");
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
         }
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:42,代码来源:AdministrationController.class.php


示例5: core_dim_add_new_contact_to_person_dimension

function core_dim_add_new_contact_to_person_dimension($object)
{
    /* @var $object Contact */
    $person_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'person'"));
    $company_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'company'"));
    $person_dim = Dimensions::findOne(array("conditions" => "`code` = 'feng_persons'"));
    if ($person_ot instanceof ObjectType && $person_dim instanceof Dimension) {
        $oid = $object->isCompany() ? $company_ot->getId() : $person_ot->getId();
        $tmp_mem = Members::findOne(array("conditions" => "`dimension_id` = " . $person_dim->getId() . " AND `object_type_id` = {$oid} AND `object_id` = " . $object->getId()));
        $reload_dimension = true;
        if ($tmp_mem instanceof Member) {
            $member = $tmp_mem;
            $reload_dimension = false;
        } else {
            $member = new Member();
            $member->setName($object->getObjectName());
            $member->setDimensionId($person_dim->getId());
            $parent_member_id = 0;
            $depth = 1;
            if ($object->isCompany()) {
                $member->setObjectTypeId($company_ot->getId());
            } else {
                $member->setObjectTypeId($person_ot->getId());
                if ($object->getCompanyId() > 0) {
                    $pmember = Members::findOne(array('conditions' => '`object_id` = ' . $object->getCompanyId() . ' AND `object_type_id` = ' . $company_ot->getId() . ' AND `dimension_id` = ' . $person_dim->getId()));
                    if ($pmember instanceof Member) {
                        $parent_member_id = $pmember->getId();
                        $depth = $pmember->getDepth() + 1;
                    }
                }
            }
            $member->setParentMemberId($parent_member_id);
            $member->setDepth($depth);
            $member->setObjectId($object->getId());
            $member->save();
        }
        $sql = "INSERT INTO `" . TABLE_PREFIX . "contact_dimension_permissions` (`permission_group_id`, `dimension_id`, `permission_type`)\n\t\t\t\t SELECT `c`.`permission_group_id`, " . $person_dim->getId() . ", 'check'\n\t\t\t\t FROM `" . TABLE_PREFIX . "contacts` `c` \n\t\t\t\t WHERE `c`.`is_company`=0 AND `c`.`user_type`!=0 AND `c`.`disabled`=0 AND `c`.`object_id`=" . $object->getId() . "\n\t\t\t\t ON DUPLICATE KEY UPDATE `dimension_id`=`dimension_id`;";
        DB::execute($sql);
        $sql = "INSERT INTO `" . TABLE_PREFIX . "contact_member_permissions` (`permission_group_id`, `member_id`, `object_type_id`, `can_write`, `can_delete`)\n\t\t\t\t SELECT `c`.`permission_group_id`, " . $member->getId() . ", `ot`.`id`, (`c`.`object_id` = " . $object->getId() . ") as `can_write`, (`c`.`object_id` = " . $object->getId() . ") as `can_delete`\n\t\t\t\t FROM `" . TABLE_PREFIX . "contacts` `c` JOIN `" . TABLE_PREFIX . "object_types` `ot` \n\t\t\t\t WHERE `c`.`is_company`=0 AND `c`.`object_id`=" . $object->getId() . "\n\t\t\t\t \tAND `c`.`user_type`!=0 AND `c`.`disabled`=0\n\t\t\t\t\tAND `ot`.`type` IN ('content_object', 'comment')\n\t\t\t\t ON DUPLICATE KEY UPDATE `member_id`=`member_id`;";
        DB::execute($sql);
        DB::execute("DELETE FROM `" . TABLE_PREFIX . "contact_member_permissions` WHERE `permission_group_id` = 0;");
        // NEW! Add contact to its own member to be searchable
        if (logged_user() instanceof Contact) {
            $ctrl = new ObjectController();
            $ctrl->add_to_members($object, array($member->getId()));
        } else {
            $object->addToMembers(array($member));
            $object->addToSharingTable();
        }
        // add permission to creator
        if ($object->getCreatedBy() instanceof Contact) {
            DB::execute("INSERT INTO `" . TABLE_PREFIX . "contact_member_permissions` (`permission_group_id`, `member_id`, `object_type_id`, `can_write`, `can_delete`)\n\t\t\t\t SELECT " . $object->getCreatedBy()->getPermissionGroupId() . ", " . $member->getId() . ", `ot`.`id`, 1, 1\n\t\t\t\t FROM `" . TABLE_PREFIX . "object_types` `ot` \n\t\t\t\t WHERE `ot`.`type` IN ('content_object', 'comment')\n\t\t\t\t ON DUPLICATE KEY UPDATE `member_id`=`member_id`;");
        }
        if ($reload_dimension) {
            evt_add("reload dimension tree", $member->getDimensionId());
        }
    }
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:58,代码来源:core_dimensions_hooks.php


示例6: save_presentation

	function save_presentation() {
		if (logged_user()->isGuest()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		ajx_current("empty");
		$postFile = array_var($_POST, 'file');
		$fileid = array_var($postFile, 'id');
		if($fileid > 0) {
			//edit presentation
			try {
				$file = ProjectFiles::findById($fileid);
				if (!$file->canEdit(logged_user())) {
					flash_error(lang('no access permissions'));
					ajx_current("empty");
					return;
				} // if
				DB::beginWork();
				$post_revision = array_var($_POST, 'new_revision_document') == 'checked'; // change file?
				$revision_comment = '';

				$file_dt['name'] = $file->getFilename();
				$file_content = unescapeSLIM(array_var($_POST, 'slimContent'));
				$file_dt['size'] = strlen($file_content);
				$file_dt['type'] = 'prsn';
				$file_dt['tmp_name'] = ROOT . '/tmp/' . rand() ;
				$handler = fopen($file_dt['tmp_name'], 'w');
				fputs($handler,$file_content);
				fclose($handler);
				$file->setFilename(array_var($postFile, 'name'));
				$file->save();
				$file->handleUploadedFile($file_dt, $post_revision, $revision_comment);
				
				if (array_var($_POST, 'checkin', false)) {
					$file->checkIn();
					ajx_current("back");
				}
				
				ApplicationLogs::createLog($file, ApplicationLogs::ACTION_EDIT);

				DB::commit();
				unlink($file_dt['tmp_name']);

				flash_success(lang('success save file', $file->getFilename()));
				evt_add("presentation saved", array("id" => $file->getId()));
				
				ajx_add("overview-panel", "reload");
			} catch(Exception $e) {
				DB::rollback();
				unlink($file_dt['tmp_name']);
				flash_error(lang('error while saving'));
				
			} // try
		} else  {
			// new presentation
			$notAllowedMember = '';
			if (!ProjectFile::canAdd(logged_user(), active_context(), $notAllowedMember)) {
				if (str_starts_with($notAllowedMember, '-- req dim --')) flash_error(lang('must choose at least one member of', str_replace_first('-- req dim --', '', $notAllowedMember, $in)));
				else flash_error(lang('no context permissions to add',lang("presentations"),$notAllowedMember));
				$this->redirectToReferer(get_url('files'));
				return ;
			} // if

			// prepare the file object
			$file = new ProjectFile();
			$file->setFilename(array_var($postFile, 'name'));
			$file->setIsVisible(true);

			//seteo esto para despues setear atributos
			$file_content = unescapeSLIM(array_var($_POST, 'slimContent'));
			$file_dt['name'] = array_var($postFile, 'name');
			$file_dt['size'] = strlen($file_content);
			$file_dt['type'] = 'prsn';

			$file->setCreatedOn(new DateTimeValue(time()) );
			try {
				DB::beginWork();
				$file_dt['tmp_name'] = ROOT . '/tmp/' . rand ();
				$handler = fopen($file_dt['tmp_name'], 'w');
				fputs($handler, unescapeSLIM(array_var($_POST, 'slimContent')));
				fclose($handler);

				$file->save();
				$file->subscribeUser(logged_user());
				$revision = $file->handleUploadedFile($file_dt, true);

				if (config_option('checkout_for_editing_online')) {
					$file->checkOut(true, logged_user());
				}
				
				ApplicationLogs::createLog($file, ApplicationLogs::ACTION_ADD);

				$object_controller = new ObjectController();
				
				// file is added to current context members
				$member_ids = array();
				$selection = active_context();
				foreach ($selection as $member) {
					if ($member instanceof Member) $member_ids[] = $member->getId();
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:FilesController.class.php


示例7: edit

 /**
  * Edit specific message
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     $this->setTemplate('add_message');
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current('empty');
         return;
     }
     $message = ProjectMessages::findById(get_id());
     if (!$message instanceof ProjectMessage) {
         flash_error(lang('message dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!$message->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $message_data = array_var($_POST, 'message');
     if (!is_array($message_data)) {
         $message_data = array('name' => $message->getObjectName(), 'text' => $message->getText(), 'type_content' => $message->getTypeContent());
         // set layout for modal form
         if (array_var($_REQUEST, 'modal')) {
             $this->setLayout("json");
             tpl_assign('modal', true);
         }
     }
     // if
     tpl_assign('message', $message);
     tpl_assign('message_data', $message_data);
     if (is_array(array_var($_POST, 'message'))) {
         foreach ($message_data as $k => &$v) {
             $v = remove_scripts($v);
         }
         try {
             //MANAGE CONCURRENCE WHILE EDITING
             /* FIXME or REMOVEME
             			$upd = array_var($_POST, 'updatedon');
             			if ($upd && $message->getUpdatedOn()->getTimestamp() > $upd && !array_var($_POST,'merge-changes') == 'true')
             			{
             				ajx_current('empty');
             				evt_add("handle edit concurrence", array(
             					"updatedon" => $message->getUpdatedOn()->getTimestamp(),
             					"genid" => array_var($_POST,'genid')
             				));
             				return;
             			}
             			if (array_var($_POST,'merge-changes') == 'true')
             			{
             				$this->setTemplate('view');
             				$edited_note = ProjectMessages::findById($message->getId());
             				tpl_assign('message', $edited_note);
             				tpl_assign('subscribers', $edited_note->getSubscribers());
             				ajx_extra_data(array("name" => $edited_note->getObjectName(), 'icon'=>'ico-message'));
             				ajx_set_no_toolbar(true);
             				ajx_set_panel(lang ('tab name',array('name'=>$edited_note->getObjectName())));					
             				return;
             			}
             			*/
             if (config_option("wysiwyg_messages")) {
                 $message_data['type_content'] = "html";
                 $message_data['text'] = preg_replace("/[\n|\r|\n\r]/", '', array_var($message_data, 'text'));
             } else {
                 $message_data['type_content'] = "text";
             }
             $message->setFromAttributes($message_data);
             DB::beginWork();
             $message->save();
             $object_controller = new ObjectController();
             $member_ids = json_decode(array_var($_POST, 'members'));
             $object_controller->add_to_members($message, $member_ids);
             $object_controller->link_to_new_object($message);
             $object_controller->add_subscribers($message);
             $object_controller->add_custom_properties($message);
             $message->resetIsRead();
             DB::commit();
             ApplicationLogs::createLog($message, ApplicationLogs::ACTION_EDIT);
             flash_success(lang('success edit message', $message->getObjectName()));
             if (array_var($_POST, 'popup', false)) {
                 ajx_current("reload");
             } else {
                 ajx_current("back");
             }
             if (array_var($_REQUEST, 'modal')) {
                 evt_add("reload current panel");
             }
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:MessageController.class.php


示例8: complete

 function complete()
 {
     if (!$this->canChangeStatus(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     try {
         $this->setCompletedOn(DateTimeValueLib::now());
         $this->setCompletedById(logged_user()->getId());
         DB::beginWork();
         $this->save();
         ApplicationLogs::createLog($this, null, ApplicationLogs::ACTION_ARCHIVE);
         DB::commit();
         flash_success(lang('success archive objects', 1));
         evt_add("workspace deleted", array("id" => $this->getId(), "name" => $this->getName()));
         ajx_current("reload");
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error archive objects'));
         ajx_current("empty");
     }
     // try
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:25,代码来源:Project.class.php


示例9: configure_widgets_submit

 function configure_widgets_submit()
 {
     ajx_current("empty");
     $widgets_data = array_var($_POST, 'widgets');
     try {
         DB::beginWork();
         foreach ($widgets_data as $name => $data) {
             $contact_widget = ContactWidgets::instance()->findOne(array('conditions' => array('contact_id = ? AND widget_name = ?', logged_user()->getId(), $name)));
             if (!$contact_widget instanceof ContactWidget) {
                 $contact_widget = new ContactWidget();
                 $contact_widget->setContactId(logged_user()->getId());
                 $contact_widget->setWidgetName($name);
             }
             $contact_widget->setOrder($data['order']);
             $contact_widget->setSection($data['section']);
             $contact_widget->save();
             if (isset($data['options']) && is_array($data['options'])) {
                 foreach ($data['options'] as $opt_name => $opt_val) {
                     $contact_widget_option = ContactWidgetOptions::instance()->findOne(array('conditions' => array('contact_id=? AND widget_name=? AND `option`=?', logged_user()->getId(), $name, $opt_name)));
                     if (!$contact_widget_option instanceof ContactWidgetOption) {
                         $contact_widget_option = new ContactWidgetOption();
                         $contact_widget_option->setContactId(logged_user()->getId());
                         $contact_widget_option->setWidgetName($name);
                         $contact_widget_option->setMemberTypeId(0);
                         $contact_widget_option->setOption($opt_name);
                     }
                     $contact_widget_option->setValue($opt_val);
                     $contact_widget_option->save();
                 }
             }
         }
         DB::commit();
         evt_add('reload tab panel', 'overview-panel');
         ajx_current("back");
     } catch (Exception $e) {
         flash_error($e->getMessage());
         DB::rollback();
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:39,代码来源:ContactController.class.php


示例10: alert

function alert($text) {
	evt_add("popup", array('title' => "Debug", 'message' => $text));
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:3,代码来源:functions.php


示例11: edit

 function edit()
 {
     $this->setTemplate('add');
     $billingCategory = BillingCategories::findById(get_id());
     if (!$billingCategory instanceof BillingCategory) {
         flash_error(lang('billing category dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!can_manage_billing(logged_user())) {
         flash_error(lang("no access permissions"));
         ajx_current("empty");
         return;
     }
     $billing_data = array_var($_POST, 'billing');
     if (!is_array($billing_data)) {
         // set layout for modal form
         if (array_var($_REQUEST, 'modal')) {
             $this->setLayout("json");
             tpl_assign('modal', true);
         }
         $billing_data = array('name' => $billingCategory->getName(), 'description' => $billingCategory->getDescription(), 'default_value' => $billingCategory->getDefaultValue(), 'report_name' => $billingCategory->getReportName());
     } else {
         $billingCategory->setFromAttributes($billing_data);
         try {
             DB::beginWork();
             $billingCategory->save();
             DB::commit();
             flash_success(lang("success edit billing category"));
             if (array_var($_REQUEST, 'modal')) {
                 evt_add("reload current panel");
             } else {
                 ajx_current("back");
             }
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
         }
     }
     tpl_assign('billing', $billingCategory);
     tpl_assign('billing_data', $billing_data);
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:44,代码来源:BillingController.class.php


示例12: edit

 function edit()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $this->setTemplate('event');
     $event = ProjectEvents::findById(get_id());
     $user_filter = isset($_GET['user_id']) ? $_GET['user_id'] : logged_user()->getId();
     $inv = EventInvitations::findById(array('event_id' => $event->getId(), 'user_id' => $user_filter));
     if ($inv != null) {
         $event->addInvitation($inv);
     }
     if (!$event->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('active_projects', logged_user()->getActiveProjects());
     $event_data = array_var($_POST, 'event');
     if (!is_array($event_data)) {
         $tag_names = $event->getTagNames();
         $setlastweek = false;
         $rsel1 = false;
         $rsel2 = false;
         $rsel3 = false;
         $forever = $event->getRepeatForever();
         $occ = 1;
         if ($event->getRepeatD() > 0) {
             $occ = 2;
             $rjump = $event->getRepeatD();
         }
         if ($event->getRepeatD() > 0 and $event->getRepeatD() % 7 == 0) {
             $occ = 3;
             $rjump = $event->getRepeatD() / 7;
         }
         if ($event->getRepeatM() > 0) {
             $occ = 4;
             $rjump = $event->getRepeatM();
         }
         if ($event->getRepeatY() > 0) {
             $occ = 5;
             $rjump = $event->getRepeatY();
         }
         if ($event->getRepeatH() > 0) {
             $occ = 6;
         }
         if ($event->getRepeatH() == 2) {
             $setlastweek = true;
         }
         if ($event->getRepeatEnd()) {
             $rend = $event->getRepeatEnd();
         }
         if ($event->getRepeatNum() > 0) {
             $rnum = $event->getRepeatNum();
         }
         if (!isset($rjump) || !is_numeric($rjump)) {
             $rjump = 1;
         }
         // decide which repeat type it is
         if ($forever) {
             $rsel1 = true;
         } else {
             if (isset($rnum) and $rnum > 0) {
                 $rsel2 = true;
             } else {
                 if (isset($rend) and $rend instanceof DateTimeValue) {
                     $rsel3 = true;
                 }
             }
         }
         //repeat until
         //if(isset($rend) AND $rend=="9999-00-00") $rend = "";
         // organize the time and date data for the html select drop downs.
         $thetime = $event->getStart()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $durtime = $event->getDuration()->getTimestamp() + logged_user()->getTimezone() * 3600 - $thetime;
         $hour = date('G', $thetime);
         // format time to 24-hour or 12-hour clock.
         if (!user_config_option('time_format_use_24')) {
             if ($hour >= 12) {
                 $pm = 1;
                 $hour = $hour - 12;
             } else {
                 $pm = 0;
             }
         }
         $event_data = array('subject' => $event->getSubject(), 'description' => $event->getDescription(), 'name' => $event->getCreatedById(), 'username' => $event->getCreatedById(), 'typeofevent' => $event->getTypeId(), 'forever' => $event->getRepeatForever(), 'usetimeandduration' => $event->getTypeId() == 3 ? 0 : 1, 'occ' => $occ, 'rjump' => $rjump, 'setlastweek' => $setlastweek, 'rend' => isset($rend) ? $rend : NULL, 'rnum' => isset($rnum) ? $rnum : NULL, 'rsel1' => $rsel1, 'rsel2' => $rsel2, 'rsel3' => $rsel3, 'thetime' => $event->getStart()->getTimestamp(), 'hour' => $hour, 'minute' => date('i', $thetime), 'month' => date('n', $thetime), 'year' => date('Y', $thetime), 'day' => date('j', $thetime), 'durtime' => $event->getDuration()->getTimestamp() - $thetime, 'durationmin' => $durtime / 60 % 60, 'durationhour' => $durtime / 3600 % 24, 'durday' => floor($durtime / 86400), 'pm' => isset($pm) ? $pm : 0, 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '', 'repeat_dow' => $event->getRepeatDow(), 'repeat_wnum' => $event->getRepeatWnum(), 'repeat_mjump' => $event->getRepeatMjump());
         // array
     }
     // if
     tpl_assign('event_data', $event_data);
     tpl_assign('event', $event);
     if (is_array(array_var($_POST, 'event'))) {
         //	MANAGE CONCURRENCE WHILE EDITING
         $upd = array_var($_POST, 'updatedon');
         if ($upd && $event->getUpdatedOn()->getTimestamp() > $upd && !array_var($_POST, 'merge-changes') == 'true') {
             ajx_current('empty');
             evt_add("handle edit concurrence", array("updatedon" => $event->getUpdatedOn()->getTimestamp(), "genid" => array_var($_POST, 'genid')));
             return;
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:EventController.class.php


示例13: add

 /**
  * Add comment
  *
  * Through this controller only logged users can post (no anonymous comments here)
  *
  * @param void
  * @return null
  */
 function add()
 {
     $this->setTemplate('add_comment');
     $object_id = get_id('object_id');
     $object = Objects::findObject($object_id);
     if (!$object instanceof ContentDataObject) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $comment = new Comment();
     $comment_data = array_var($_POST, 'comment');
     tpl_assign('comment_form_object', $object);
     tpl_assign('comment', $comment);
     tpl_assign('comment_data', $comment_data);
     if (is_array($comment_data)) {
         try {
             try {
                 $attached_files = ProjectFiles::handleHelperUploads(active_context());
             } catch (Exception $e) {
                 $attached_files = null;
             }
             // try
             $comment->setFromAttributes($comment_data);
             $comment->setRelObjectId($object_id);
             $comment->setObjectName(substr_utf($comment->getText(), 0, 250));
             DB::beginWork();
             $comment->save();
             $comment->addToMembers($object->getMembers());
             $comment->addToSharingTable();
             if (is_array($attached_files)) {
                 foreach ($attached_files as $attached_file) {
                     $comment->attachFile($attached_file);
                 }
                 // foreach
             }
             // if
             // Subscribe user to object
             if (!$object->isSubscriber(logged_user())) {
                 $object->subscribeUser(logged_user());
             }
             // if
             if (strlen($comment->getText()) < 100) {
                 $comment_head = $comment->getText();
             } else {
                 $lastpos = strpos($comment->getText(), " ", 100);
                 if ($lastpos === false) {
                     $comment_head = $comment->getText();
                 } else {
                     $comment_head = substr($comment->getText(), 0, $lastpos) . "...";
                 }
             }
             $comment_head = html_to_text($comment_head);
             DB::commit();
             ApplicationLogs::createLog($comment, ApplicationLogs::ACTION_COMMENT, false, false, true, $comment_head);
             flash_success(lang('success add comment'));
             evt_add("scroll to comment", array('comment_id' => $comment->getId()));
             ajx_current("reload");
         } catch (Exception $e) {
             DB::rollback();
             ajx_current("empty");
             flash_error($e->getMessage());
         }
         // try
     }
     // if
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:76,代码来源:CommentController.class.php


示例14: mark_dao_validation_error_fields

function mark_dao_validation_error_fields($e)
{
    if ($e instanceof DAOValidationError) {
        $obj = $e->getObject();
        if (is_array($obj->getFieldsWithErrorsAfterValidation())) {
            foreach ($obj->getFieldsWithErrorsAfterValidation() as $f) {
                evt_add('mark_error_field', array('field' => $f));
            }
        }
    }
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:11,代码来源:form.php


示例15: delete_account

 /**
  * Delete specific mail account
  *
  * @access public
  * @param void
  * @return null
  */
 function delete_account()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $account = MailAccounts::findById(get_id());
     if (!$account instanceof MailAccount) {
         flash_error(lang('error delete mail account'));
         ajx_current("empty");
         return;
     }
     if (!$account->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $deleteMails = array_var($_GET, 'deleteMails', false);
     try {
         $accId = $account->getId();
         $accName = $account->getName();
         $accEmail = $account->getEmail();
         DB::beginWork();
         $account->delete($deleteMails);
         DB::commit();
         evt_add("mail account deleted", array("id" => $accId, "name" => $accName, "email" => $accEmail));
         flash_success(lang('success delete mail account'));
         if (array_var($_GET, 'reload', false)) {
             ajx_current("reload");
         } else {
             ajx_current("back");
         }
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error delete mail account'));
         ajx_current("empty");
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:46,代码来源:MailController.class.php


示例16: edit

 /**
  * Edit specific message
  *
  * @access public
  * @param void
  * @return null
  */
 function edit()
 {
     $this->setTemplate('add_message');
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current('empty');
         return;
     }
     $message = ProjectMessages::findById(get_id());
     if (!$message instanceof ProjectMessage) {
         flash_error(lang('message dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!$message->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $message_data = array_var($_POST, 'message');
     if (!is_array($message_data)) {
         $tag_names = $message->getTagNames();
         $message_data = array('milestone_id' => $message->getMilestoneId(), 'title' => $message->getTitle(), 'text' => $message->getText(), 'additional_text' => $message->getAdditionalText(), 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '', 'is_private' => $message->isPrivate(), 'is_important' => $message->getIsImportant(), 'comments_enabled' => $message->getCommentsEnabled(), 'anonymous_comments_enabled' => $message->getAnonymousCommentsEnabled());
         // array
     }
     // if
     tpl_assign('message', $message);
     tpl_assign('message_data', $message_data);
     if (is_array(array_var($_POST, 'message'))) {
         try {
             //MANAGE CONCURRENCE WHILE EDITING
             $upd = array_var($_POST, 'updatedon');
             if ($upd && $message->getUpdatedOn()->getTimestamp() > $upd && !array_var($_POST, 'merge-changes') == 'true') {
                 ajx_current('empty');
                 evt_add("handle edit concurrence", array("updatedon" => $message->getUpdatedOn()->getTimestamp(), "genid" => array_var($_POST, 'genid')));
                 return;
             }
             if (array_var($_POST, 'merge-changes') == 'true') {
                 $this->setTemplate('view');
                 $edited_note = ProjectMessages::findById($message->getId());
                 tpl_assign('message', $edited_note);
                 tpl_assign('subscribers', $edited_note-& 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ew_AddFilter函数代码示例发布时间:2022-05-15
下一篇:
PHP evolve_truncate函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap