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


PHP featurecode::update方法代码示例

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


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

示例1: featurecodeadmin_update

function featurecodeadmin_update($req)
{
    foreach ($req as $key => $item) {
        // Split up...
        // 0 - action
        // 1 - modulename
        // 2 - featurename
        $arr = explode("#", $key);
        if (count($arr) == 3) {
            $action = $arr[0];
            $modulename = $arr[1];
            $featurename = $arr[2];
            $fieldvalue = $item;
            // Is there a more efficient way of doing this?
            switch ($action) {
                case "ena":
                    $fcc = new featurecode($modulename, $featurename);
                    if ($fieldvalue == 1) {
                        $fcc->setEnabled(true);
                    } else {
                        $fcc->setEnabled(false);
                    }
                    $fcc->update();
                    break;
                case "custom":
                    $fcc = new featurecode($modulename, $featurename);
                    if ($fieldvalue == $fcc->getDefault()) {
                        $fcc->setCode('');
                        // using default
                    } else {
                        $fcc->setCode($fieldvalue);
                    }
                    $fcc->update();
                    break;
            }
        }
    }
    needreload();
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:39,代码来源:functions.inc.php

示例2: update

 public function update($codes = array())
 {
     if (!empty($codes)) {
         foreach ($codes as $module => $features) {
             foreach ($features as $name => $data) {
                 $fcc = new \featurecode($module, $name);
                 if (!empty($data['enable'])) {
                     $fcc->setEnabled(true);
                 } else {
                     $fcc->setEnabled(false);
                 }
                 if (empty($data['customize']) || $data['code'] == $fcc->getDefault()) {
                     $fcc->setCode('');
                 } else {
                     $fcc->setCode($data['code']);
                 }
                 $fcc->update();
             }
         }
         needreload();
     }
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:22,代码来源:Featurecodeadmin.class.php

示例3: featurecode

//    the Free Software Foundation, either version 2 of the License, or
//    (at your option) any later version.
//
//    FreePBX is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>.
//
// Copyright (C) 2005 mheydon1973
//
//for translation only
if (false) {
    _("Call Waiting");
    _("Call Waiting - Activate");
    _("Call Waiting - Deactivate");
}
// Register FeatureCode - Activate
$fcc = new featurecode('callwaiting', 'cwon');
$fcc->setDescription('Call Waiting - Activate');
$fcc->setDefault('*70');
$fcc->update();
unset($fcc);
// Register FeatureCode - Deactivate
$fcc = new featurecode('callwaiting', 'cwoff');
$fcc->setDescription('Call Waiting - Deactivate');
$fcc->setDefault('*71');
$fcc->update();
unset($fcc);
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:install.php

示例4: miscapps_edit

function miscapps_edit($miscapps_id, $description, $ext, $dest, $enabled = true)
{
    global $db;
    $sql = "UPDATE miscapps SET " . "description = '" . $db->escapeSimple($description) . "', " . "ext = '" . $db->escapeSimple($ext) . "', " . "dest = '" . $db->escapeSimple($dest) . "' " . "WHERE miscapps_id = " . $db->escapeSimple($miscapps_id);
    $result = $db->query($sql);
    if (DB::IsError($result)) {
        die_freepbx($result->getMessage() . $sql);
    }
    $fc = new featurecode('miscapps', 'miscapp_' . $miscapps_id);
    $fc->setDescription($description);
    $fc->setDefault($ext, true);
    $fc->setEnabled($enabled);
    $fc->update();
}
开发者ID:hardikk,项目名称:HNH,代码行数:14,代码来源:functions.inc.php

示例5: recordings_update

function recordings_update($id, $rname, $descr, $request, $fcode = 0, $fcode_pass = '')
{
    global $db;
    // Update the descriptive fields
    $fcode_pass = preg_replace("/[^0-9*]/", "", trim($fcode_pass));
    $results = sql("UPDATE recordings SET displayname = '" . $db->escapeSimple($rname) . "', description = '" . $db->escapeSimple($descr) . "', fcode='{$fcode}', fcode_pass='" . $fcode_pass . "' WHERE id = '{$id}'");
    // Build the file list from _REQUEST
    $astsnd = isset($asterisk_conf['astvarlibdir']) ? $asterisk_conf['astvarlibdir'] : '/var/lib/asterisk';
    $astsnd .= "/sounds/";
    $recordings = array();
    // Set the file names from the submitted page, sysrec[N]
    // We don't set if feature code was selected, we use what was already there
    // because the fields will have been disabled and won't be accessible in the
    // $_REQUEST array anyhow
    //
    if ($fcode != 1) {
        // delete the feature code if it existed
        //
        $fcc = new featurecode('recordings', 'edit-recording-' . $id);
        $fcc->delete();
        unset($fcc);
        foreach ($request as $key => $val) {
            $res = strpos($key, 'sysrec');
            if ($res !== false) {
                // strip out any relative paths, since this is coming from a URL
                str_replace('..', '', $val);
                $recordings[substr($key, 6)] = $val;
            }
        }
        // Stick the filename in the database
        recordings_set_file($id, implode('&', $recordings));
    } else {
        // Add the feature code if it is needed
        //
        $fcc = new featurecode('recordings', 'edit-recording-' . $id);
        $fcc->setDescription("Edit Recording: {$rname}");
        $fcc->setDefault('*29' . $id);
        $fcc->update();
        unset($fcc);
    }
    // In _REQUEST there are also various actions (possibly)
    // up[N] - Move file id N up one place
    // down[N] - Move fid N down one place
    // del[N] - Delete fid N
    foreach ($request as $key => $val) {
        if (strpos($key, "_") == 0) {
            $up = strpos($key, "up");
            $down = strpos($key, "down");
            $del = strpos($key, "del");
        }
        if ($up !== false) {
            $up = substr($key, 2);
            recordings_move_file_up($id, $up);
        }
        if ($del !== false) {
            $del = substr($key, 3);
            recordings_delete_file($id, $del);
        }
        if ($down !== false) {
            $down = substr($key, 4);
            recordings_move_file_down($id, $down);
        }
    }
}
开发者ID:hardikk,项目名称:HNH,代码行数:64,代码来源:functions.inc.php

示例6: updateRecording

 /**
  * Update Recording by ID
  * @param integer $id          The recording ID
  * @param string  $name        The recording short name
  * @param string  $description The recording long name
  * @param string  $files       & separated list of files to playback
  * @param integer $fcode       Feature Code number_format
  * @param string  $fcode_pass  Feature code password
  */
 public function updateRecording($id, $name, $description, $files, $fcode = 0, $fcode_pass = '')
 {
     $sql = "UPDATE recordings SET displayname = ?, description = ?, filename = ?, fcode = ?, fcode_pass = ? WHERE id = ?";
     $sth = $this->db->prepare($sql);
     $sth->execute(array($name, $description, $files, $fcode, $fcode_pass, $id));
     if ($fcode != 1) {
         // delete the feature code if it existed
         //
         $fcc = new \featurecode('recordings', 'edit-recording-' . $id);
         $fcc->delete();
         unset($fcc);
     } else {
         // Add the feature code if it is needed
         //
         $fcc = new \featurecode('recordings', 'edit-recording-' . $id);
         $fcc->setDescription("Edit Recording: {$name}");
         $fcc->setDefault('*29' . $id);
         $fcc->setProvideDest();
         $fcc->update();
         unset($fcc);
     }
     needreload();
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:32,代码来源:Recordings.class.php

示例7: edit

 public function edit($miscapps_id, $description, $ext, $dest, $enabled = true)
 {
     $db = $this->db;
     $sql = 'UPDATE miscapps SET description = ?, ext = ?, dest = ? WHERE miscapps_id = ?';
     $q = $db->prepare($sql);
     $q->execute(array($description, $ext, $dest, $miscapps_id));
     if ($q) {
         $fc = new \featurecode('miscapps', 'miscapp_' . $miscapps_id);
         $fc->setDescription($description);
         $fc->setDefault($ext, true);
         $fc->setEnabled($enabled);
         $fc->update();
     }
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:14,代码来源:Miscapps.class.php

示例8: createFeatureCode

 public function createFeatureCode($id, $displayname = '')
 {
     $fcc = new \featurecode('timeconditions', 'toggle-mode-' . $id);
     if ($displayname) {
         $fcc->setDescription("{$id}: {$displayname}");
     } else {
         $fcc->setDescription($id . _(": Time Condition Override"));
     }
     $fcc->setDefault('*27' . $id);
     $fcc->setProvideDest();
     $fcc->update();
     unset($fcc);
     $this->setState($id, '');
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:14,代码来源:Timeconditions.class.php

示例9: daynight_edit

function daynight_edit($post, $id = 0)
{
    global $db;
    // TODO: Probably have separate add and edit (and change in page.daynight.php also)
    //       Need to set the day/night mode in the system if new
    // Delete all the old dests
    if ($post['action'] != "add") {
        sql("DELETE FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description','day_recording_id','night_recording_id') AND ext = {$id}");
    }
    $day = isset($post[$post['goto0'] . '0']) ? $post[$post['goto0'] . '0'] : '';
    $night = isset($post[$post['goto1'] . '1']) ? $post[$post['goto1'] . '1'] : '';
    sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'day', '{$day}')");
    sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'night', '{$night}')");
    if (isset($post['password']) && trim($post['password'] != "")) {
        $password = trim($post['password']);
        sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'password', '{$password}')");
    }
    $fc_description = isset($post['fc_description']) ? trim($post['fc_description']) : "";
    sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'fc_description', '" . $db->escapeSimple($fc_description) . "')");
    $day_recording_id = isset($post['day_recording_id']) ? trim($post['day_recording_id']) : "";
    sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'day_recording_id', '{$day_recording_id}')");
    $night_recording_id = isset($post['night_recording_id']) ? trim($post['night_recording_id']) : "";
    sql("INSERT INTO daynight (ext, dmode, dest) VALUES ({$id}, 'night_recording_id', '{$night_recording_id}')");
    $dn = new dayNightObject($id);
    $dn->del();
    $dn->create($post['state']);
    $fcc = new featurecode('daynight', 'toggle-mode-' . $id);
    if ($fc_description) {
        $fcc->setDescription("{$id}: {$fc_description}");
    } else {
        $fcc->setDescription("{$id}: Call Flow Toggle Control");
    }
    $fcc->setDefault('*28' . $id);
    $fcc->setProvideDest();
    $fcc->update();
    unset($fcc);
    needreload();
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:38,代码来源:functions.inc.php

示例10: install

 public function install()
 {
     $fcc = new \featurecode('blacklist', 'blacklist_add');
     $fcc->setDescription('Blacklist a number');
     $fcc->setHelpText('Adds a number to the Blacklist Module.  All calls from that number to the system will receive a disconnect recording.  Manage these in the Blacklist module.');
     $fcc->setDefault('*30');
     $fcc->setProvideDest();
     $fcc->update();
     unset($fcc);
     $fcc = new \featurecode('blacklist', 'blacklist_remove');
     $fcc->setDescription('Remove a number from the blacklist');
     $fcc->setHelpText('Removes a number from the Blacklist Module');
     $fcc->setDefault('*31');
     $fcc->setProvideDest();
     $fcc->update();
     unset($fcc);
     $fcc = new featurecode('blacklist', 'blacklist_last');
     $fcc->setDescription('Blacklist the last caller');
     $fcc->setHelpText('Adds the last caller to the Blacklist Module.  All calls from that number to the system will receive a disconnect recording.');
     $fcc->setDefault('*32');
     $fcc->update();
     unset($fcc);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:23,代码来源:Blacklist.class.php


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